Author: borges
Date: 2011-07-01 09:30:09 -0400 (Fri, 01 Jul 2011)
New Revision: 10908
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
Log:
clean up
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-07-01
12:39:30 UTC (rev 10907)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-07-01
13:30:09 UTC (rev 10908)
@@ -202,7 +202,7 @@
closeExecutor = orderedExecutorFactory.getExecutor();
this.interceptors = interceptors;
-
+
}
public void connect(int initialConnectAttempts, boolean failoverOnInitialConnection)
throws HornetQException
@@ -377,7 +377,7 @@
sessions.remove(session);
}
}
-
+
public void connectionReadyForWrites(final Object connectionID, final boolean ready)
{
}
@@ -418,7 +418,8 @@
return;
}
- // we need to stopthe factory from connecting if it is in the middle aof trying to
failover before we get the lock
+ // we need to stop the factory from connecting if it is in the middle aof trying to
failover
+ // before we get the lock
causeExit();
synchronized (createSessionLock)
{
@@ -461,7 +462,7 @@
{
stopPingingAfterOne = true;
}
-
+
public void resumePinging()
{
stopPingingAfterOne = false;
@@ -866,7 +867,7 @@
{
sessionsToFailover = new HashSet<ClientSessionInternal>(sessions);
}
-
+
for (ClientSessionInternal session : sessionsToFailover)
{
session.handleFailover(connection);
@@ -902,7 +903,7 @@
if (reconnectAttempts != 0)
{
count++;
-
+
if (reconnectAttempts != -1 && count == reconnectAttempts)
{
log.warn("Tried " + reconnectAttempts + " times to
connect. Now giving up on reconnecting it.");
@@ -1011,7 +1012,7 @@
{
log.debug("Trying to connect at the main server using connector
:" + connectorConfig);
}
-
+
tc = connector.createConnection();
if (tc == null)
@@ -1020,7 +1021,7 @@
{
log.debug("Main server is not up. Hopefully there's a
backup configured now!");
}
-
+
try
{
connector.close();
@@ -1058,7 +1059,7 @@
{
log.debug("Backup is not active yet");
}
-
+
try
{
connector.close();
@@ -1072,12 +1073,12 @@
else
{
/*looks like the backup is now live, lets use that*/
-
+
if (log.isDebugEnabled())
{
log.debug("Connected to the backup at " +
backupConfig);
}
-
+
connectorConfig = backupConfig;
backupConfig = null;
@@ -1171,6 +1172,7 @@
return connection;
}
+ @Override
public void finalize() throws Throwable
{
if (!closed)
@@ -1262,7 +1264,7 @@
if (type == PacketImpl.DISCONNECT)
{
final DisconnectMessage msg = (DisconnectMessage)packet;
-
+
closeExecutor.execute(new Runnable()
{
// Must be executed on new thread since cannot block the netty thread for
a long time and fail can
@@ -1374,7 +1376,7 @@
first = false;
long now = System.currentTimeMillis();
-
+
if (clientFailureCheckPeriod != -1 && connectionTTL != -1 && now
>= lastCheck + connectionTTL )
{
if (!connection.checkDataReceived())
@@ -1405,7 +1407,7 @@
}
/**
- *
+ *
*/
public void send()
{
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2011-07-01
12:39:30 UTC (rev 10907)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2011-07-01
13:30:09 UTC (rev 10908)
@@ -40,7 +40,7 @@
/**
* A packet handler for all packets that need to be handled at the server level
- *
+ *
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
@@ -129,9 +129,9 @@
Version version = server.getVersion();
int[] compatibleList = version.getCompatibleVersionList();
boolean isCompatibleClient = false;
- for (int i = 0; i < compatibleList.length; i++)
+ for (int element : compatibleList)
{
- if (compatibleList[i] == request.getVersion())
+ if (element == request.getVersion())
{
isCompatibleClient = true;
break;
@@ -194,7 +194,7 @@
catch (HornetQException e)
{
log.error("Failed to create session ", e);
- response = new HornetQExceptionMessage((HornetQException)e);
+ response = new HornetQExceptionMessage(e);
if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
{
@@ -251,7 +251,7 @@
// Even though session exists, we can't reattach since confi window
size == -1,
// i.e. we don't have a resend cache for commands, so we just close
the old session
// and let the client recreate
-
+
log.warn("Reattach request from " +
connection.getRemoteAddress() + " failed as there is no confirmationWindowSize
configured, which may be ok for your system");
sessionHandler.closeListeners();