Author: borges
Date: 2011-11-03 09:42:07 -0400 (Thu, 03 Nov 2011)
New Revision: 11653
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/FileLockNodeManager.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTemporaryQueue.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/JMSServerManager.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/CountDownSessionFailureListener.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java
Log:
clean up
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -960,11 +960,8 @@
{
if (ClientSessionFactoryImpl.log.isTraceEnabled())
{
- ClientSessionFactoryImpl.log.trace("getConnectionWithRetry::" +
reconnectAttempts +
- " with retryInterval = " +
- retryInterval +
- " multiplier = " +
- retryIntervalMultiplier, new
Exception("trace"));
+ ClientSessionFactoryImpl.log.trace("getConnectionWithRetry::" +
reconnectAttempts + " with retryInterval = " +
+ retryInterval + " multiplier = " + retryIntervalMultiplier,
new Exception("trace"));
}
long interval = retryInterval;
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/FileLockNodeManager.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -35,7 +35,7 @@
{
private final Logger log = Logger.getLogger(this.getClass());
- protected static final String SERVER_LOCK_NAME = "server.lock";
+ private static final String SERVER_LOCK_NAME = "server.lock";
private static final String ACCESS_MODE = "rw";
@@ -149,13 +149,13 @@
return false;
}
}
-
+
public boolean isLiveLocked()
{
return liveLock != null;
}
-
+
@Override
public void interrupt()
{
@@ -258,7 +258,7 @@
backupLock.release();
backupLock = null;
}
-
+
}
public String getDirectory()
@@ -386,7 +386,7 @@
{
// This just means that another object on the same JVM is holding the lock
}
-
+
if (lock == null)
{
try
@@ -403,7 +403,7 @@
return lock;
}
}
-
+
// todo this is here because sometimes channel.lock throws a resource deadlock
exception but trylock works,
// need to investigate further and review
FileLock lock;
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTemporaryQueue.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTemporaryQueue.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTemporaryQueue.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -13,7 +13,6 @@
package org.hornetq.jms.client;
-import javax.jms.JMSException;
import javax.jms.TemporaryQueue;
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/JMSServerManager.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/JMSServerManager.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/JMSServerManager.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -18,7 +18,6 @@
import javax.naming.Context;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQComponent;
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -15,7 +15,6 @@
import javax.management.ObjectName;
-import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.management.AddressControl;
import org.hornetq.api.core.management.QueueControl;
import org.hornetq.api.core.management.ResourceNames;
@@ -29,7 +28,6 @@
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.jms.client.HornetQConnectionFactory;
-import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQTopic;
import org.hornetq.jms.management.impl.JMSConnectionFactoryControlImpl;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -40,8 +40,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
-import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.NodeManager;
import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.core.server.impl.InVMNodeManager;
@@ -338,7 +336,7 @@
{
if (live)
{
- return new
TransportConfiguration(NettyAcceptorFactory.class.getCanonicalName());
+ return new TransportConfiguration(NETTY_ACCEPTOR_FACTORY);
}
else
{
@@ -347,8 +345,7 @@
server1Params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME,
org.hornetq.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT +
1);
- return new
TransportConfiguration(NettyAcceptorFactory.class.getCanonicalName(),
- server1Params);
+ return new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, server1Params);
}
}
@@ -356,7 +353,7 @@
{
if (live)
{
- return new
TransportConfiguration(NettyConnectorFactory.class.getCanonicalName());
+ return new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
}
else
{
@@ -365,7 +362,7 @@
server1Params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME,
org.hornetq.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT +
1);
- return new
TransportConfiguration(NettyConnectorFactory.class.getCanonicalName(), server1Params);
+ return new TransportConfiguration(NETTY_CONNECTOR_FACTORY, server1Params);
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -13,18 +13,16 @@
package org.hornetq.tests.integration.cluster.util;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
-import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.cluster.impl.ClusterManagerImpl;
+import org.hornetq.tests.util.CountDownSessionFailureListener;
/**
* A SameProcessHornetQServer
@@ -49,7 +47,7 @@
public void destroy()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // To change body of implemented methods use File | Settings | File Templates.
}
public void setIdentity(String identity)
@@ -89,24 +87,10 @@
public void crash(boolean waitFailure, ClientSession... sessions) throws Exception
{
- final CountDownLatch latch = new CountDownLatch(sessions.length);
-
- class MyListener implements SessionFailureListener
- {
- public void connectionFailed(final HornetQException me, boolean failedOver)
- {
- log.debug("MyListener.connectionFailed failedOver=" + failedOver,
me);
- latch.countDown();
- }
-
- public void beforeReconnect(HornetQException exception)
- {
- log.debug("MyListener.beforeReconnect", exception);
- }
- }
+ CountDownSessionFailureListener listener = new
CountDownSessionFailureListener(sessions.length);
for (ClientSession session : sessions)
{
- session.addFailureListener(new MyListener());
+ session.addFailureListener(listener);
}
ClusterManagerImpl clusterManager = (ClusterManagerImpl)
server.getClusterManager();
@@ -118,14 +102,11 @@
if (waitFailure)
{
// Wait to be informed of failure
- boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);
- Assert.assertTrue("Failed to stop the server! Latch count is " +
latch.getCount(), ok);
+ boolean ok = listener.getLatch().await(10000, TimeUnit.MILLISECONDS);
+ Assert.assertTrue("Failed to stop the server! Latch count is " +
listener.getLatch().getCount(), ok);
}
}
- /* (non-Javadoc)
- * @see org.hornetq.tests.integration.cluster.util.TestableServer#getServer()
- */
public HornetQServer getServer()
{
return server;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/CountDownSessionFailureListener.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/CountDownSessionFailureListener.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/CountDownSessionFailureListener.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -11,9 +11,14 @@
public CountDownSessionFailureListener()
{
- latch = new CountDownLatch(1);
+ this(1);
}
+ public CountDownSessionFailureListener(int n)
+ {
+ latch = new CountDownLatch(n);
+ }
+
public CountDownSessionFailureListener(CountDownLatch latch)
{
this.latch = latch;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java 2011-11-03
13:41:25 UTC (rev 11652)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java 2011-11-03
13:42:07 UTC (rev 11653)
@@ -27,7 +27,6 @@
*/
public static void createClusterConnectionConf(Configuration configuration, String
name, String... connectors)
{
-
List<String> conn = new ArrayList<String>(connectors.length);
for (String iConn : connectors)
{