[hornetq-commits] JBoss hornetq SVN: r7976 - in trunk/src/main/org/hornetq/core: remoting/server/impl and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Sep 21 13:21:33 EDT 2009
Author: jmesnil
Date: 2009-09-21 13:21:33 -0400 (Mon, 21 Sep 2009)
New Revision: 7976
Modified:
trunk/src/main/org/hornetq/core/client/impl/ConnectionManagerImpl.java
trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
Log:
HORNETQ-133: Connection not cleaned up if client failure occurs before 1st ping after connection creation
* send a ping after each remoting connection creation on the client-side (in addition to regular pings)
* in RemotingServiceImpl, create the RemotingConnection with default connection TTL (unless the value
is overridden in the configuration)
Modified: trunk/src/main/org/hornetq/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ConnectionManagerImpl.java 2009-09-21 17:18:28 UTC (rev 7975)
+++ trunk/src/main/org/hornetq/core/client/impl/ConnectionManagerImpl.java 2009-09-21 17:21:33 UTC (rev 7976)
@@ -971,14 +971,23 @@
clientFailureCheckPeriod,
System.currentTimeMillis()));
- if (clientFailureCheckPeriod != -1 && pingerFuture == null)
+ if (clientFailureCheckPeriod != -1)
{
- pingRunnable = new PingRunnable();
+ if (pingerFuture == null)
+ {
+ pingRunnable = new PingRunnable();
- pingerFuture = scheduledThreadPool.scheduleWithFixedDelay(new ActualScheduled(pingRunnable),
- 0,
- clientFailureCheckPeriod,
- TimeUnit.MILLISECONDS);
+ pingerFuture = scheduledThreadPool.scheduleWithFixedDelay(new ActualScheduled(pingRunnable),
+ 0,
+ clientFailureCheckPeriod,
+ TimeUnit.MILLISECONDS);
+ }
+ // send a ping every time we create a new remoting connection
+ // to set up its TTL on the server side
+ else
+ {
+ pingRunnable.run();
+ }
}
if (debug)
Modified: trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2009-09-21 17:18:28 UTC (rev 7975)
+++ trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2009-09-21 17:21:33 UTC (rev 7976)
@@ -25,6 +25,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.TransportConfiguration;
import org.hornetq.core.exception.HornetQException;
@@ -315,9 +316,14 @@
channel1.setHandler(handler);
+ long ttl = ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+ if (config.getConnectionTTLOverride() != -1)
+ {
+ ttl = config.getConnectionTTLOverride();
+ }
final ConnectionEntry entry = new ConnectionEntry(rc,
System.currentTimeMillis(),
- config.getConnectionTTLOverride());
+ ttl);
connections.put(connection.getID(), entry);
More information about the hornetq-commits
mailing list