Author: borges
Date: 2011-10-28 09:00:09 -0400 (Fri, 28 Oct 2011)
New Revision: 11613
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
Check if SequentialFile is already closed journal wrapper.
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java
===================================================================
---
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java 2011-10-27
16:33:24 UTC (rev 11612)
+++
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java 2011-10-28
13:00:09 UTC (rev 11613)
@@ -58,6 +58,7 @@
@Override
public void stop() throws Exception
{
+ if (currentFile.getFile().isOpen())
currentFile.getFile().close();
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-10-27
16:33:24 UTC (rev 11612)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-10-28
13:00:09 UTC (rev 11613)
@@ -45,6 +45,7 @@
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.cluster.util.TestableServer;
+import org.hornetq.tests.util.CountDownSessionFailureListener;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.TransportConfigurationUtils;
@@ -1582,24 +1583,10 @@
locator.setFailoverOnInitialConnection(true);
createSessionFactory();
- final CountDownLatch latch = new CountDownLatch(1);
-
- class MyListener implements SessionFailureListener
- {
- public void connectionFailed(final HornetQException me, boolean failedOver)
- {
- latch.countDown();
- }
-
- public void beforeReconnect(HornetQException exception)
- {
- System.out.println("MyListener.beforeReconnect");
- }
- }
-
+ CountDownSessionFailureListener listener = new CountDownSessionFailureListener();
ClientSession session = sendAndConsume(sf, true);
- session.addFailureListener(new MyListener());
+ session.addFailureListener(listener);
backupServer.stop();
@@ -1610,7 +1597,7 @@
backupServer.start();
- assertTrue("session failure listener", latch.await(5,
TimeUnit.SECONDS));
+ assertTrue("session failure listener", listener.getLatch().await(5,
TimeUnit.SECONDS));
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
@@ -1744,24 +1731,11 @@
locator.setFailoverOnInitialConnection(true);
locator.setReconnectAttempts(-1);
sf = createSessionFactoryAndWaitForTopology(locator, 2);
- final CountDownLatch latch = new CountDownLatch(1);
+ CountDownSessionFailureListener listener = new CountDownSessionFailureListener();
- class MyListener implements SessionFailureListener
- {
- public void connectionFailed(final HornetQException me, boolean failedOver)
- {
- latch.countDown();
- }
-
- public void beforeReconnect(HornetQException exception)
- {
- System.out.println("MyListener.beforeReconnect");
- }
- }
-
ClientSession session = sendAndConsume(sf, true);
- session.addFailureListener(new MyListener());
+ session.addFailureListener(listener);
backupServer.stop();
@@ -1772,7 +1746,7 @@
backupServer.start();
- assertTrue("session failure listener", latch.await(5,
TimeUnit.SECONDS));
+ assertTrue("session failure listener", listener.getLatch().await(5,
TimeUnit.SECONDS));
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
Show replies by date