[jboss-cvs] JBoss Messaging SVN: r2951 - in trunk/src/main/org/jboss/messaging/core/impl: clusterconnection and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 3 08:32:13 EDT 2007
Author: timfox
Date: 2007-08-03 08:32:13 -0400 (Fri, 03 Aug 2007)
New Revision: 2951
Modified:
trunk/src/main/org/jboss/messaging/core/impl/DefaultClusterNotifier.java
trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java
Log:
Moved close timeout into the ConnectionInfo
Modified: trunk/src/main/org/jboss/messaging/core/impl/DefaultClusterNotifier.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/DefaultClusterNotifier.java 2007-08-03 12:20:43 UTC (rev 2950)
+++ trunk/src/main/org/jboss/messaging/core/impl/DefaultClusterNotifier.java 2007-08-03 12:32:13 UTC (rev 2951)
@@ -31,10 +31,7 @@
import org.jboss.messaging.core.contract.ClusterNotifier;
import org.jboss.messaging.util.ConcurrentReaderHashSet;
-import EDU.oswego.cs.dl.util.concurrent.Callable;
-import EDU.oswego.cs.dl.util.concurrent.TimedCallable;
-
/**
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -47,8 +44,6 @@
{
private static final Logger log = Logger.getLogger(DefaultClusterNotifier.class);
- private static final long NOTIFICATION_TIMEOUT = 3000;
-
private Set listeners;
public DefaultClusterNotifier()
@@ -66,7 +61,7 @@
listeners.add(listener);
}
- public void sendNotification(final ClusterNotification notification)
+ public void sendNotification(ClusterNotification notification)
{
Iterator iter = listeners.iterator();
@@ -75,23 +70,6 @@
final ClusterNotificationListener listener = (ClusterNotificationListener)iter.next();
listener.notify(notification);
-
- //We used a timed callable to make sure the call completes in a reasonable time
- //This is because there have been issues with remoting hanging when closing message suckers
- //and we don't want this to cause the entire failover process to hang
-
- Callable callable = new Callable() { public Object call() { listener.notify(notification); return null; } };
-
- Callable timedCallable = new TimedCallable(callable, NOTIFICATION_TIMEOUT);
-
- try
- {
- timedCallable.call();
- }
- catch (Exception e)
- {
- log.error("Failed to make notification", e);
- }
}
}
Modified: trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java 2007-08-03 12:20:43 UTC (rev 2950)
+++ trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java 2007-08-03 12:32:13 UTC (rev 2951)
@@ -29,6 +29,8 @@
import java.util.List;
import java.util.Map;
+import javax.jms.JMSException;
+
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
@@ -40,6 +42,9 @@
import org.jboss.messaging.core.contract.Queue;
import org.jboss.messaging.core.contract.Replicator;
+import EDU.oswego.cs.dl.util.concurrent.Callable;
+import EDU.oswego.cs.dl.util.concurrent.TimedCallable;
+
/**
*
* This class handles connections to other nodes that are used to pull messages from remote queues to local queues
@@ -57,7 +62,9 @@
public class ClusterConnectionManager implements ClusterNotificationListener
{
private static final Logger log = Logger.getLogger(ClusterConnectionManager.class);
-
+
+ private static final long CLOSE_TIMEOUT = 2000;
+
private boolean trace = log.isTraceEnabled();
private Map connections;
@@ -634,15 +641,34 @@
suckers.clear();
+
+ //Note we use a timed callable since remoting has a habit of hanging on attempting to close
+ //We do not want this to hang the system - especially failover
+
+ Callable callable = new Callable() { public Object call()
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException ignore)
+ {
+ }
+ return null;
+ } };
+
+ Callable timedCallable = new TimedCallable(callable, CLOSE_TIMEOUT);
+
try
{
- connection.close();
+ timedCallable.call();
}
catch (Throwable t)
{
- //Ignore - the other server might have closed so this is ok
+ //Ignore - the server might have already closed - so this is ok
}
+
connection = null;
started = false;
More information about the jboss-cvs-commits
mailing list