Skip to content

Commit

Permalink
#XD-457 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
penemue committed Sep 7, 2015
1 parent 821d1f8 commit 96f7359
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions environment/src/main/java/jetbrains/exodus/env/EnvironmentImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,26 @@ public void executeTransactionSafeTask(@NotNull final Runnable task) {
public void clear() {
suspendGC();
try {
synchronized (commitLock) {
synchronized (metaLock) {
checkInactive(false);
log.clear();
runAllTransactionSafeTasks();
txnSafeTasks.clear();
throwableOnCommit = null;
final Pair<MetaTree, Integer> meta = MetaTree.create(this);
metaTree = meta.getFirst();
structureId.set(meta.getSecond());
acquireTransaction(true, false); // wait for and stop all writing transactions
try {
acquireTransaction(true, true); // wait for and stop all read-only transactions
try {
synchronized (commitLock) {
synchronized (metaLock) {
log.clear();
runAllTransactionSafeTasks();
txnSafeTasks.clear();
throwableOnCommit = null;
final Pair<MetaTree, Integer> meta = MetaTree.create(this);
metaTree = meta.getFirst();
structureId.set(meta.getSecond());
}
}
} finally {
releaseTransaction(true, true);
}
} finally {
releaseTransaction(true, false);
}
} finally {
resumeGC();
Expand Down

0 comments on commit 96f7359

Please sign in to comment.