Author: jmesnil
Date: 2009-12-01 11:59:49 -0500 (Tue, 01 Dec 2009)
New Revision: 8480
Modified:
trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
failover issues
* in HornetQServerImpl.return a false ReattachSessionResponseMessage is the server is not
started. Returning null was throwing a swallowed NPE
and the (blocking) client was not receiving any response
* in ClientSessionImple.handleFailover(), retry sending the CreateSessionMessage in case
the server is accepting connections but not properly
started (thus refusing to create the session)
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2009-12-01 16:36:31
UTC (rev 8479)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2009-12-01 16:59:49
UTC (rev 8480)
@@ -824,8 +824,25 @@
autoCommitAcks,
preAcknowledge,
confirmationWindowSize);
+ boolean retry = false;
+ do
+ {
+ try
+ {
+ channel1.sendBlocking(createRequest);
+ }
+ catch(HornetQException e)
+ {
+ // the session was created while its server was starting, retry it:
+ if (e.getCode() == HornetQException.SESSION_CREATION_REJECTED)
+ {
+ log.warn("Server is starting, retry to create the
session");
- channel1.sendBlocking(createRequest);
+ retry = true;
+ continue;
+ }
+ }
+ } while(retry);
channel.clearCommands();
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-12-01 16:36:31
UTC (rev 8479)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-12-01 16:59:49
UTC (rev 8480)
@@ -554,7 +554,7 @@
{
if (!started)
{
- return null;
+ return new ReattachSessionResponseMessage(-1, false);
}
ServerSession session = sessions.get(name);
Show replies by date