Author: toad
Date: 2009-01-29 17:30:10 +0000 (Thu, 29 Jan 2009)
New Revision: 25370

Modified:
   branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
   
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucketKillJob.java
Log:
Refactor slightly


Modified: 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java    
    2009-01-29 17:26:02 UTC (rev 25369)
+++ 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java    
    2009-01-29 17:30:10 UTC (rev 25370)
@@ -291,7 +291,7 @@
                };
        }
 
-       private transient DBJob killMe;
+       private transient SegmentedBucketChainBucketKillJob killMe;
        
        private transient boolean runningSegStore;
        
@@ -323,7 +323,7 @@
                                                        if(killMe != null) 
return;
                                                        killMe = new 
SegmentedBucketChainBucketKillJob(SegmentedBucketChainBucket.this);
                                                }
-                                               
dbJobRunner.queueRestartJob(killMe, NativeThread.HIGH_PRIORITY, container);
+                                               
killMe.scheduleRestart(container, context);
                                        } finally {
                                                
synchronized(SegmentedBucketChainBucket.this) {
                                                        runningSegStore = false;

Modified: 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucketKillJob.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucketKillJob.java
 2009-01-29 17:26:02 UTC (rev 25369)
+++ 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucketKillJob.java
 2009-01-29 17:30:10 UTC (rev 25370)
@@ -10,6 +10,8 @@
        
        final SegmentedBucketChainBucket bcb;
 
+       private final short RESTART_PRIO = NativeThread.HIGH_PRIORITY;
+       
        public SegmentedBucketChainBucketKillJob(SegmentedBucketChainBucket 
bucket) {
                bcb = bucket;
        }
@@ -22,10 +24,16 @@
                if(bcb.removeContents(container)) {
                        // More work needs to be done.
                        // We will have already been removed, so re-add, in 
case we crash soon.
-                       context.jobRunner.queueRestartJob(this, 
NativeThread.HIGH_PRIORITY, container);
+                       scheduleRestart(container, context);
                        // But try to sort it out now ...
                        context.jobRunner.queue(this, 
NativeThread.NORM_PRIORITY, true);
+               } else {
+                       context.jobRunner.removeRestartJob(this, RESTART_PRIO, 
container);
                }
        }
+       
+       public void scheduleRestart(ObjectContainer container, ClientContext 
context) {
+               context.jobRunner.queueRestartJob(this, RESTART_PRIO, 
container);
+       }
 
 }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to