Repository: kylin Updated Branches: refs/heads/master 3c49c9e0c -> cd4e116ac
minor, make FileResourceStore synchronized Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/cd4e116a Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/cd4e116a Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/cd4e116a Branch: refs/heads/master Commit: cd4e116ac3391d4da975a29c21a0c69f053463a6 Parents: 3c49c9e Author: Yang Li <liy...@apache.org> Authored: Fri Feb 10 21:41:50 2017 +0800 Committer: Yang Li <liy...@apache.org> Committed: Fri Feb 10 21:41:50 2017 +0800 ---------------------------------------------------------------------- .../common/persistence/FileResourceStore.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/cd4e116a/core-common/src/main/java/org/apache/kylin/common/persistence/FileResourceStore.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/FileResourceStore.java b/core-common/src/main/java/org/apache/kylin/common/persistence/FileResourceStore.java index 3e012f5..d84e587 100644 --- a/core-common/src/main/java/org/apache/kylin/common/persistence/FileResourceStore.java +++ b/core-common/src/main/java/org/apache/kylin/common/persistence/FileResourceStore.java @@ -50,7 +50,7 @@ public class FileResourceStore extends ResourceStore { } @Override - protected NavigableSet<String> listResourcesImpl(String folderPath) throws IOException { + synchronized protected NavigableSet<String> listResourcesImpl(String folderPath) throws IOException { String[] names = file(folderPath).list(); if (names == null) // not a directory return null; @@ -64,13 +64,13 @@ public class FileResourceStore extends ResourceStore { } @Override - protected boolean existsImpl(String resPath) throws IOException { + synchronized protected boolean existsImpl(String resPath) throws IOException { File f = file(resPath); return f.exists() && f.isFile(); // directory is not considered a resource } @Override - protected List<RawResource> getAllResourcesImpl(String folderPath, long timeStart, long timeEndExclusive) throws IOException { + synchronized protected List<RawResource> getAllResourcesImpl(String folderPath, long timeStart, long timeEndExclusive) throws IOException { NavigableSet<String> resources = listResources(folderPath); if (resources == null) return Collections.emptyList(); @@ -95,7 +95,7 @@ public class FileResourceStore extends ResourceStore { } @Override - protected RawResource getResourceImpl(String resPath) throws IOException { + synchronized protected RawResource getResourceImpl(String resPath) throws IOException { File f = file(resPath); if (f.exists() && f.isFile()) { if (f.length() == 0) { @@ -108,7 +108,7 @@ public class FileResourceStore extends ResourceStore { } @Override - protected long getResourceTimestampImpl(String resPath) throws IOException { + synchronized protected long getResourceTimestampImpl(String resPath) throws IOException { File f = file(resPath); if (f.exists() && f.isFile()) return f.lastModified(); @@ -117,7 +117,7 @@ public class FileResourceStore extends ResourceStore { } @Override - protected void putResourceImpl(String resPath, InputStream content, long ts) throws IOException { + synchronized protected void putResourceImpl(String resPath, InputStream content, long ts) throws IOException { File f = file(resPath); f.getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(f); @@ -131,7 +131,7 @@ public class FileResourceStore extends ResourceStore { } @Override - protected long checkAndPutResourceImpl(String resPath, byte[] content, long oldTS, long newTS) throws IOException, IllegalStateException { + synchronized protected long checkAndPutResourceImpl(String resPath, byte[] content, long oldTS, long newTS) throws IOException, IllegalStateException { File f = file(resPath); if ((f.exists() && f.lastModified() != oldTS) || (f.exists() == false && oldTS != 0)) throw new IllegalStateException("Overwriting conflict " + resPath + ", expect old TS " + oldTS + ", but found " + f.lastModified()); @@ -143,13 +143,13 @@ public class FileResourceStore extends ResourceStore { } @Override - protected void deleteResourceImpl(String resPath) throws IOException { + synchronized protected void deleteResourceImpl(String resPath) throws IOException { File f = file(resPath); f.delete(); } @Override - protected String getReadableResourcePathImpl(String resPath) { + synchronized protected String getReadableResourcePathImpl(String resPath) { return file(resPath).toString(); }