Author: clebert.suconic(a)jboss.com
Date: 2011-07-06 20:15:00 -0400 (Wed, 06 Jul 2011)
New Revision: 10941
Added:
branches/Branch_2_2_EAP_cluster_clean2/tmphsperfdata_clebertsuconic/
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverOnFlowControlTest.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
Log:
Fixing tests
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -37,6 +37,8 @@
{
private static final Logger log = Logger.getLogger(InVMConnection.class);
+
+ private static final boolean isTrace = log.isTraceEnabled();
private final BufferHandler handler;
@@ -45,6 +47,9 @@
private final String id;
private boolean closed;
+
+ // Used on tests
+ public static boolean flushEnabled = true;
private final int serverID;
@@ -135,7 +140,10 @@
if (!closed)
{
copied.readInt(); // read and discard
-
+ if (isTrace)
+ {
+ log.trace(InVMConnection.this + "::Sending inVM
packet");
+ }
handler.bufferReceived(id, copied);
}
}
@@ -145,10 +153,17 @@
InVMConnection.log.error(msg, e);
throw new IllegalStateException(msg, e);
}
+ finally
+ {
+ if (isTrace)
+ {
+ log.trace(InVMConnection.this + "::packet sent done");
+ }
+ }
}
});
- if (flush)
+ if (flush && flushEnabled)
{
final CountDownLatch latch = new CountDownLatch(1);
executor.execute(new Runnable(){
@@ -160,7 +175,10 @@
try
{
- latch.await(10, TimeUnit.SECONDS);
+ if (!latch.await(10, TimeUnit.SECONDS))
+ {
+ log.warn("Timed out flushing channel on InVMConnection");
+ }
}
catch (InterruptedException e)
{
@@ -193,6 +211,11 @@
{
}
+ public void disableFlush()
+ {
+ flushEnabled = false;
+ }
+
public Executor getExecutor()
{
return executor;
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -267,18 +267,33 @@
}
failureCheckAndFlushThread.close();
+
// We need to stop them accepting first so no new connections are accepted after we
send the disconnect message
for (Acceptor acceptor : acceptors)
{
+ if (log.isDebugEnabled())
+ {
+ log.debug("Pausing acceptor " + acceptor);
+ }
acceptor.pause();
}
+ if (log.isDebugEnabled())
+ {
+ log.debug("Sending disconnect on live connections");
+ }
+
// Now we ensure that no connections will process any more packets after this
method is complete
// then send a disconnect packet
for (ConnectionEntry entry : connections.values())
{
RemotingConnection conn = entry.connection;
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Sending connection.disconnection packet to " + conn);
+ }
conn.disconnect();
}
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -1043,7 +1043,7 @@
server1.start();
server0.start();
- final int numMessages = 1000;
+ final int numMessages = 300;
final int totalrepeats = 3;
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -99,20 +99,6 @@
verifyNotReceive(0);
}
- public void testLoop() throws Exception
- {
- for (int i = 0 ; i < 10; i++)
- {
- log.info("#test " + i);
- testStartSourceServerBeforeTargetServer();
- if (i + 1 < 100000)
- {
- tearDown();
- setUp();
- }
- }
-
- }
public void testStartSourceServerBeforeTargetServer() throws Exception
{
startServers(0, 1);
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverOnFlowControlTest.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverOnFlowControlTest.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverOnFlowControlTest.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -25,9 +25,12 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ServerLocatorInternal;
+import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.remoting.impl.invm.InVMConnection;
import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.remoting.Connection;
/**
* A FailoverOnFlowControlTest
@@ -39,6 +42,8 @@
public class FailoverOnFlowControlTest extends FailoverTestBase
{
+
+ private static Logger log = Logger.getLogger(FailoverOnFlowControlTest.class);
// Constants -----------------------------------------------------
@@ -58,24 +63,35 @@
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
locator.setProducerWindowSize(1000);
+ locator.setRetryInterval(123);
final ArrayList<ClientSession> sessionList = new
ArrayList<ClientSession>();
Interceptor interceptorClient = new Interceptor()
{
AtomicInteger count = new AtomicInteger(0);
public boolean intercept(Packet packet, RemotingConnection connection) throws
HornetQException
{
- System.out.println("Intercept..." + packet.getClass().getName());
+ log.debug("Intercept..." + packet.getClass().getName());
if (packet instanceof SessionProducerCreditsMessage )
{
SessionProducerCreditsMessage credit =
(SessionProducerCreditsMessage)packet;
- System.out.println("Credits: " + credit.getCredits());
+ log.debug("Credits: " + credit.getCredits());
if (count.incrementAndGet() == 2)
{
try
{
- crash(sessionList.get(0));
+ log.debug("### crashing server");
+
+ InVMConnection.flushEnabled = false;
+ try
+ {
+ crash(sessionList.get(0));
+ }
+ finally
+ {
+ InVMConnection.flushEnabled = true;
+ }
}
catch (Exception e)
{
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-07-06
20:52:54 UTC (rev 10940)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-07-07
00:15:00 UTC (rev 10941)
@@ -22,6 +22,7 @@
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;
@@ -34,6 +35,7 @@
*/
public class SameProcessHornetQServer implements TestableServer
{
+ private static Logger log = Logger.getLogger(SameProcessHornetQServer.class);
private HornetQServer server;
@@ -85,12 +87,13 @@
{
public void connectionFailed(final HornetQException me, boolean failedOver)
{
+ log.debug("MyListener.connectionFailed failedOver=" + failedOver,
me);
latch.countDown();
}
public void beforeReconnect(HornetQException exception)
{
- System.out.println("MyListener.beforeReconnect");
+ log.debug("MyListener.beforeReconnect", exception);
}
}
for (ClientSession session : sessions)
@@ -102,11 +105,6 @@
clusterManager.clear();
server.stop(true);
-
- // Wait to be informed of failure
- boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);
-
- Assert.assertTrue(ok);
}
/* (non-Javadoc)
Show replies by date