mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
SOLR-13821: Return the size of the file
This commit is contained in:
parent
e428315387
commit
086bad30f0
@ -280,6 +280,11 @@ public class DistribPackageStore implements PackageStore {
|
|||||||
return type == FileType.DIRECTORY;
|
return type == FileType.DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long size() {
|
||||||
|
return realPath().toFile().length();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeMap(EntryWriter ew) throws IOException {
|
public void writeMap(EntryWriter ew) throws IOException {
|
||||||
MetaData metaData = readMetaData();
|
MetaData metaData = readMetaData();
|
||||||
@ -288,6 +293,8 @@ public class DistribPackageStore implements PackageStore {
|
|||||||
ew.put("dir", true);
|
ew.put("dir", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ew.put("size", size());
|
||||||
ew.put("timestamp", getTimeStamp());
|
ew.put("timestamp", getTimeStamp());
|
||||||
if (metaData != null)
|
if (metaData != null)
|
||||||
metaData.writeMap(ew);
|
metaData.writeMap(ew);
|
||||||
|
@ -113,6 +113,8 @@ public interface PackageStore {
|
|||||||
|
|
||||||
Date getTimeStamp();
|
Date getTimeStamp();
|
||||||
|
|
||||||
|
long size();
|
||||||
|
|
||||||
boolean isDir();
|
boolean isDir();
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class PackageLoader implements Closeable {
|
|||||||
} else {
|
} else {
|
||||||
Package p = packageClassLoaders.remove(e.getKey());
|
Package p = packageClassLoaders.remove(e.getKey());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
//other classes are holding to a reference to this objecec
|
//other classes are holding to a reference to this object
|
||||||
// they should know that this is removed
|
// they should know that this is removed
|
||||||
p.markDeleted();
|
p.markDeleted();
|
||||||
closeWhileHandlingException(p);
|
closeWhileHandlingException(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user