Author: borges
Date: 2011-11-02 12:19:01 -0400 (Wed, 02 Nov 2011)
New Revision: 11638
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnection.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.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-02
16:18:22 UTC (rev 11637)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -1056,11 +1056,8 @@
if (pingerFuture != null)
{
pingRunnable.cancel();
-
pingerFuture.cancel(false);
-
pingRunnable = null;
-
pingerFuture = null;
}
}
@@ -1520,7 +1517,7 @@
{
private final CoreRemotingConnection conn;
- public CloseRunnable(CoreRemotingConnection conn)
+ private CloseRunnable(CoreRemotingConnection conn)
{
this.conn = conn;
}
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -88,8 +88,8 @@
{
static final Logger log = Logger.getLogger(NettyAcceptor.class);
- private ClusterConnection clusterConnection;
-
+ private final ClusterConnection clusterConnection;
+
private ChannelFactory channelFactory;
private volatile ChannelGroup serverChannelGroup;
@@ -139,11 +139,11 @@
private final int nioRemotingThreads;
private final HttpKeepAliveRunnable httpKeepAliveRunnable;
-
+
private HttpAcceptorHandler httpHandler = null;
private final ConcurrentMap<Object, NettyConnection> connections = new
ConcurrentHashMap<Object, NettyConnection>();
-
+
private final Map<String, Object> configuration;
private final Executor threadPool;
@@ -163,8 +163,8 @@
private final long batchDelay;
private final boolean directDeliver;
-
+
public NettyAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
final BufferDecoder decoder,
@@ -184,11 +184,11 @@
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool)
{
-
+
this.clusterConnection = clusterConnection;
-
+
this.configuration = configuration;
-
+
this.handler = handler;
this.decoder = decoder;
@@ -372,7 +372,7 @@
if (httpEnabled)
{
handlers.put("http-decoder", new HttpRequestDecoder());
-
+
handlers.put("http-aggregator", new
HttpChunkAggregator(Integer.MAX_VALUE));
handlers.put("http-encoder", new HttpResponseEncoder());
@@ -509,7 +509,7 @@
serverChannelGroup.add(serverChannel);
}
}
-
+
public Map<String, Object> getConfiguration()
{
return this.configuration;
@@ -586,7 +586,7 @@
e.printStackTrace();
}
}
-
+
if (httpHandler != null)
{
httpHandler.shutdown();
@@ -646,7 +646,7 @@
{
this.notificationService = notificationService;
}
-
+
/* (non-Javadoc)
* @see org.hornetq.spi.core.remoting.Acceptor#getClusterConnection()
*/
@@ -733,12 +733,12 @@
public void connectionReadyForWrites(final Object connectionID, boolean ready)
{
NettyConnection conn = connections.get(connectionID);
-
+
if (conn != null)
{
conn.fireReady(ready);
- }
- }
+ }
+ }
}
private class BatchFlusher implements Runnable
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnection.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnection.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnection.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -270,7 +270,7 @@
readyListeners.remove(listener);
}
- public void fireReady(final boolean ready)
+ void fireReady(final boolean ready)
{
for (ReadyListener listener: readyListeners)
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-02
16:18:22 UTC (rev 11637)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -161,7 +161,7 @@
ScheduledExecutorService getScheduledPool();
ExecutorService getThreadPool();
-
+
ExecutorFactory getExecutorFactory();
void setGroupingHandler(GroupingHandler groupingHandler);
@@ -172,8 +172,6 @@
ReplicationManager getReplicationManager();
- boolean checkActivate() throws Exception;
-
void deployDivert(DivertConfiguration config) throws Exception;
void destroyDivert(SimpleString name) throws Exception;
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -1057,36 +1057,6 @@
return connectorsService;
}
- public synchronized boolean checkActivate() throws Exception
- {
- if (configuration.isBackup())
- {
- // Handle backup server activation
-
- if (!configuration.isSharedStore())
- {
- if (replicationEndpoint == null)
- {
- HornetQServerImpl.log.warn("There is no replication endpoint,
can't activate this backup server");
-
- throw new HornetQException(HornetQException.INTERNAL_ERROR,
"Can't activate the server");
- }
-
- replicationEndpoint.stop();
- }
-
- // Complete the startup procedure
-
- HornetQServerImpl.log.info("Activating backup server");
-
- configuration.setBackup(false);
-
- initialisePart2();
- }
-
- return true;
- }
-
public void deployDivert(DivertConfiguration config) throws Exception
{
if (config.getName() == null)
Modified: trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
---
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -759,7 +759,7 @@
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
- class InVMNodeManagerServer extends HornetQServerImpl
+ public final class InVMNodeManagerServer extends HornetQServerImpl
{
final NodeManager nodeManager;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.cluster.failover;
-import org.hornetq.core.config.Configuration;
import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
import org.hornetq.tests.integration.cluster.util.TestableServer;
@@ -21,8 +20,6 @@
* A NettyReplicatedFailoverTest
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
*/
public class NettyReplicatedFailoverTest extends NettyFailoverTest
{
@@ -46,17 +43,17 @@
{
return new SameProcessHornetQServer(createServer(true, liveConfig));
}
-
+
@Override
protected TestableServer createBackupServer()
{
return new SameProcessHornetQServer(createServer(true, backupConfig));
}
-
+
@Override
protected void createConfigs() throws Exception
{
- createReplicatedConfigs();
+ createReplicatedConfigs();
}
// Private -------------------------------------------------------
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-11-02
16:18:22 UTC (rev 11637)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-11-02
16:19:01 UTC (rev 11638)
@@ -28,7 +28,6 @@
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.management.MBeanServer;
import junit.framework.Assert;
@@ -40,13 +39,11 @@
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.NodeManager;
-import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.core.server.impl.InVMNodeManager;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
@@ -54,21 +51,20 @@
import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.tests.integration.jms.server.management.JMSUtil;
import org.hornetq.tests.unit.util.InVMContext;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
/**
- *
+ *
* A JMSFailoverTest
*
* A simple test to test failover when using the JMS API.
* Most of the failover tests are done on the Core API.
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 7 Nov 2008 11:13:39
*
*
@@ -256,15 +252,17 @@
public void testManualFailover() throws Exception
{
- HornetQConnectionFactory jbcfLive =
HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
-
new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ HornetQConnectionFactory jbcfLive =
+ HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
+ new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
jbcfLive.setBlockOnNonDurableSend(true);
jbcfLive.setBlockOnDurableSend(true);
- HornetQConnectionFactory jbcfBackup =
HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
-
new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory",
-
backupParams));
+ HornetQConnectionFactory jbcfBackup =
+ HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
+ new
TransportConfiguration(INVM_CONNECTOR_FACTORY,
+
backupParams));
jbcfBackup.setBlockOnNonDurableSend(true);
jbcfBackup.setBlockOnDurableSend(true);
jbcfBackup.setInitialConnectAttempts(-1);
@@ -348,13 +346,12 @@
protected void startServers() throws Exception
{
NodeManager nodeManager = new InVMNodeManager();
- backuptc = new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory",
backupParams);
- livetc = new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
+ backuptc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, backupParams);
+ livetc = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
- liveAcceptortc = new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory");
+ liveAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
- backupAcceptortc = new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory",
- backupParams);
+ backupAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY,
backupParams);
backupConf = createBasicConfig(0);
@@ -378,8 +375,7 @@
backupConf.setSecurityEnabled(false);
backupConf.setJournalType(getDefaultJournalType());
backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
- backupConf.getAcceptorConfigurations()
- .add(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory",
backupParams));
+ backupConf.getAcceptorConfigurations().add(new
TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams));
backupConf.setBackup(true);
backupConf.setSharedStore(true);
backupConf.setBindingsDirectory(getBindingsDir());
@@ -389,7 +385,7 @@
backupConf.setLargeMessagesDirectory(getLargeMessagesDir());
backupConf.setPersistenceEnabled(true);
backupConf.setClustered(true);
- backupService = new InVMNodeManagerServer(backupConf, nodeManager);
+ backupService = new ServiceTestBase.InVMNodeManagerServer(backupConf,
nodeManager);
backupJMSService = new JMSServerManagerImpl(backupService);
@@ -481,53 +477,4 @@
this.e = e;
}
}
-
- // Inner classes -------------------------------------------------
- class InVMNodeManagerServer extends HornetQServerImpl
- {
- final NodeManager nodeManager;
-
- public InVMNodeManagerServer(NodeManager nodeManager)
- {
- super();
- this.nodeManager = nodeManager;
- }
-
- public InVMNodeManagerServer(Configuration configuration, NodeManager nodeManager)
- {
- super(configuration);
- this.nodeManager = nodeManager;
- }
-
- public InVMNodeManagerServer(Configuration configuration, MBeanServer mbeanServer,
NodeManager nodeManager)
- {
- super(configuration, mbeanServer);
- this.nodeManager = nodeManager;
- }
-
- public InVMNodeManagerServer(Configuration configuration,
- HornetQSecurityManager securityManager,
- NodeManager nodeManager)
- {
- super(configuration, securityManager);
- this.nodeManager = nodeManager;
- }
-
- public InVMNodeManagerServer(Configuration configuration,
- MBeanServer mbeanServer,
- HornetQSecurityManager securityManager,
- NodeManager nodeManager)
- {
- super(configuration, mbeanServer, securityManager);
- this.nodeManager = nodeManager;
- }
-
- @Override
- protected NodeManager createNodeManager(String directory)
- {
- return nodeManager;
- }
-
- }
-
}