You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by mc...@apache.org on 2007/05/30 12:59:44 UTC

svn commit: r542794 - /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java

Author: mckierna
Date: Wed May 30 03:59:44 2007
New Revision: 542794

URL: http://svn.apache.org/viewvc?view=rev&rev=542794
Log:
ensure we do not send makeConnection msgs aggresively

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java?view=diff&rev=542794&r1=542793&r2=542794
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/polling/PollingManager.java Wed May 30 03:59:44 2007
@@ -18,6 +18,7 @@
 package org.apache.sandesha2.polling;
 
 import java.util.ArrayList;
+import java.util.HashMap
 import java.util.LinkedList;
 
 import org.apache.axis2.AxisFault;
@@ -62,6 +63,8 @@
 	
 	private static final int POLLING_MANAGER_WAIT_TIME = 3000;
 	
+	private HashMap pollTimes = new HashMap();
+	
 	public PollingManager() {
 		super(POLLING_MANAGER_WAIT_TIME);
 	}
@@ -94,6 +97,16 @@
 				}
 	
 				entry = (SequenceEntry) allSequencesList.get(nextIndex++);
+				
+				long now = System.currentTimeMillis();
+				Long time = (Long) pollTimes.get(entry.getSequenceId());
+				if(time != null && (now - time.longValue()) < POLLING_MANAGER_WAIT_TIME) {
+					// We have polled for this sequence too recently, so skip over this one
+					if (log.isDebugEnabled()) log.debug("Exit: PollingManager::internalRun, skipping sequence, not sleeping");
+					return false;
+				}
+				pollTimes.put(entry.getSequenceId(), new Long(now));
+				
 			}
 			if(log.isDebugEnabled()) log.debug("Chose sequence " + entry.getSequenceId());
 



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org