add missing exclusive lock protection for database restore
@@ -227,7 +227,8 @@ public class OLocalPaginatedStorage extends OAbstractPaginatedStorage {
try {
if (!isClosed())
close(true, false);
-
+ try {
+ stateLock.acquireWriteLock();
OZIPCompressionUtil.uncompressDirectory(in, getStoragePath().toString(), iListener);
final Path cacheStateFile = getStoragePath().resolve(O2QCache.CACHE_STATE_FILE);
@@ -254,6 +255,9 @@ public class OLocalPaginatedStorage extends OAbstractPaginatedStorage {
} catch (Exception e) {
OLogManager.instance().error(this, "Error on calling callback on database restore", e);
}
+ } finally {
+ stateLock.releaseWriteLock();
+ }
open(null, null, new OContextConfiguration());
} catch (RuntimeException e) {
