r26966 - trunk/freenet/src/freenet/node

[email protected] Sat, 18 Apr 2009 13:59:20 +0000
Newsgroups gmane.network.freenet.cvs,gmane.spam.detected
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-18 13:59:19 +0000 (Sat, 18 Apr 2009)
New Revision: 26966

Modified:
   trunk/freenet/src/freenet/node/FailureTableEntry.java
Log:
refactor cleanup() into cleanupRequestor() and cleanupRequested()

Modified: trunk/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTableEntry.java	2009-04-18 13:58:48 UTC (rev 26965)
+++ trunk/freenet/src/freenet/node/FailureTableEntry.java	2009-04-18 13:59:19 UTC (rev 26966)
@@ -442,11 +442,16 @@
 		}
 		return -1; // not timed out
 	}
+	
+	public synchronized boolean cleanup() {
+		long now = System.currentTimeMillis(); // don't pass in as a pass over the whole FT may take a while. get it in the method.
+		
+		return cleanupRequestor(now) && cleanupRequested(now);
+	}
 
-	public synchronized boolean cleanup() {
+	private boolean cleanupRequestor(long now) {
 		boolean empty = true;
 		int x = 0;
-		long now = System.currentTimeMillis(); // don't pass in as a pass over the whole FT may take a while. get it in the method.
 		for(int i=0;i<requestorNodes.length;i++) {
 			WeakReference<PeerNode> ref = requestorNodes[i];
 			if(ref == null) continue;
@@ -474,7 +479,13 @@
 			requestorTimes = newRequestorTimes;
 			requestorBootIDs = newRequestorBootIDs;
 		}
-		x = 0;
+		
+		return empty;
+	}
+	
+	private boolean cleanupRequested(long now) {
+		boolean empty = true;
+		int x = 0;
 		for(int i=0;i<requestedNodes.length;i++) {
 			WeakReference<PeerNode> ref = requestedNodes[i];
 			if(ref == null) continue;