Author: toad
Date: 2008-10-23 18:11:24 +0000 (Thu, 23 Oct 2008)
New Revision: 23058
Modified:
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
Log:
Create killMe lazily, remove it only if needed, don't persist it.
Modified:
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
===================================================================
---
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
2008-10-23 18:09:02 UTC (rev 23057)
+++
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
2008-10-23 18:11:24 UTC (rev 23058)
@@ -230,6 +230,9 @@
container.ext().store(segments,
1);
container.ext().store(SegmentedBucketChainBucket.this, 1);
container.deactivate(oldSeg, 1);
+
synchronized(SegmentedBucketChainBucket.this) {
+ if(killMe == null)
return;
+ }
dbJobRunner.removeRestartJob(killMe, NativeThread.HIGH_PRIORITY, container);
}
@@ -238,7 +241,7 @@
};
}
- private final DBJob killMe = new
SegmentedBucketChainBucketKillJob(this);
+ private transient DBJob killMe;
protected synchronized SegmentedChainBucketSegment makeSegment(int
index, final SegmentedChainBucketSegment oldSeg) {
if(oldSeg != null) {
@@ -249,6 +252,10 @@
container.ext().store(segments, 1);
container.ext().store(SegmentedBucketChainBucket.this, 1);
container.deactivate(oldSeg, 1);
+
synchronized(SegmentedBucketChainBucket.this) {
+ if(killMe != null) return;
+ killMe = new
SegmentedBucketChainBucketKillJob(SegmentedBucketChainBucket.this);
+ }
dbJobRunner.queueRestartJob(killMe,
NativeThread.HIGH_PRIORITY, container);
}