JBoss hornetq SVN: r11574 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-21 10:14:30 -0400 (Fri, 21 Oct 2011)
New Revision: 11574
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Guard against race when closing ServerLocator and using it to create a session factory
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-21 14:14:17 UTC (rev 11573)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-21 14:14:30 UTC (rev 11574)
@@ -602,10 +602,7 @@
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception
{
- if (closed)
- {
- throw new IllegalStateException("Cannot create session factory, server locator is closed (maybe it has been garbage collected)");
- }
+ assertOpen();
try
{
@@ -616,7 +613,11 @@
throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to initialise session factory", e);
}
- ClientSessionFactoryInternal factory = new ClientSessionFactoryImpl(this,
+ synchronized (this)
+ {
+ assertOpen();
+ ClientSessionFactoryInternal factory =
+ new ClientSessionFactoryImpl(this,
transportConfiguration,
callTimeout,
clientFailureCheckPeriod,
@@ -633,16 +634,22 @@
addFactory(factory);
- return factory;
+ return factory;
+ }
}
- public ClientSessionFactory createSessionFactory() throws Exception
+ private void assertOpen()
{
if (closed || closing)
{
throw new IllegalStateException("Cannot create session factory, server locator is closed (maybe it has been garbage collected)");
}
+ }
+ public ClientSessionFactory createSessionFactory() throws Exception
+ {
+ assertOpen();
+
try
{
initialise();
@@ -669,6 +676,7 @@
synchronized (this)
{
+ assertOpen();
boolean retry;
int attempts = 0;
do
@@ -1218,6 +1226,8 @@
staticConnector.disconnect();
}
+ synchronized (this)
+ {
Set<ClientSessionFactoryInternal> clonedFactory = new HashSet<ClientSessionFactoryInternal>(factories);
for (ClientSessionFactory factory : clonedFactory)
@@ -1233,6 +1243,7 @@
}
factories.clear();
+ }
if (shutdownPool)
{
@@ -1655,7 +1666,7 @@
class Connector
{
- private TransportConfiguration initialConnector;
+ private final TransportConfiguration initialConnector;
private volatile ClientSessionFactoryInternal factory;
13 years, 2 months
JBoss hornetq SVN: r11573 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-21 10:14:17 -0400 (Fri, 21 Oct 2011)
New Revision: 11573
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
Fix NPE on cleanUp of OnewayTwoNodeClusterTest.testNeverStartTargetStartSourceThenStopSource
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-10-21 14:14:04 UTC (rev 11572)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-10-21 14:14:17 UTC (rev 11573)
@@ -169,9 +169,13 @@
if (servers[i] == null)
continue;
- for (ClusterConnection cc : servers[i].getClusterManager().getClusterConnections())
+ final ClusterManager clusterManager = servers[i].getClusterManager();
+ if (clusterManager != null)
{
- cc.stop();
+ for (ClusterConnection cc : clusterManager.getClusterConnections())
+ {
+ cc.stop();
+ }
}
stopComponent(servers[i]);
13 years, 2 months
JBoss hornetq SVN: r11572 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration: security and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-21 10:14:04 -0400 (Fri, 21 Oct 2011)
New Revision: 11572
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/security/SecurityTest.java
Log:
Use unittest cluster password, verify code of expected security exceptions
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java 2011-10-21 14:13:48 UTC (rev 11571)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java 2011-10-21 14:14:04 UTC (rev 11572)
@@ -58,9 +58,7 @@
*/
public void testSendManagementMessageWithClusterAdminUser() throws Exception
{
- doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER,
- ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
- true);
+ doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER, CLUSTER_PASSWORD, true);
}
public void testSendManagementMessageWithAdminRole() throws Exception
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/security/SecurityTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/security/SecurityTest.java 2011-10-21 14:13:48 UTC (rev 11571)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/security/SecurityTest.java 2011-10-21 14:14:04 UTC (rev 11572)
@@ -33,7 +33,12 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQServer;
@@ -41,6 +46,7 @@
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.spi.core.security.JAASSecurityManager;
+import org.hornetq.tests.util.CreateMessage;
import org.hornetq.tests.util.ServiceTestBase;
import org.jboss.security.SimpleGroup;
@@ -51,8 +57,8 @@
public class SecurityTest extends ServiceTestBase
{
/*
- * create session tests
- * */
+ * create session tests
+ */
private static final String addressA = "addressA";
private static final String queueA = "queueA";
@@ -72,7 +78,7 @@
protected void tearDown() throws Exception
{
locator.close();
-
+
super.tearDown();
}
@@ -120,7 +126,7 @@
ClientSessionFactory cf = locator.createSessionFactory();
try
{
- ClientSession session = cf.createSession(false, true, true);
+ cf.createSession(false, true, true);
Assert.fail("should throw exception");
}
catch (HornetQException e)
@@ -151,7 +157,7 @@
try
{
- ClientSession session = cf.createSession("newuser", "awrongpass", false, true, true, false, -1);
+ cf.createSession("newuser", "awrongpass", false, true, true, false, -1);
Assert.fail("should not throw exception");
}
catch (HornetQException e)
@@ -493,52 +499,52 @@
try
{
server.start();
-
+
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
-
+
HornetQSecurityManager securityManager = server.getSecurityManager();
-
+
securityManager.addUser("auser", "pass");
-
+
Role role = new Role("arole", true, true, true, false, false, false, false);
-
+
Set<Role> roles = new HashSet<Role>();
-
+
roles.add(role);
-
+
securityRepository.addMatch(SecurityTest.addressA, roles);
-
+
securityManager.addRole("auser", "arole");
-
+
locator.setBlockOnNonDurableSend(true);
-
+
ClientSessionFactory cf = locator.createSessionFactory();
-
+
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
-
+
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
-
+
ClientProducer cp = session.createProducer(SecurityTest.addressA);
-
+
cp.send(session.createMessage(false));
-
+
session.start();
-
+
ClientConsumer cons = session.createConsumer(queueA);
-
+
ClientMessage receivedMessage = cons.receive(5000);
-
+
assertNotNull(receivedMessage);
-
+
receivedMessage.acknowledge();
-
+
role = new Role("arole", false, false, true, false, false, false, false);
-
+
roles = new HashSet<Role>();
-
+
roles.add(role);
-
-
+
+
// This was added to validate https://issues.jboss.org/browse/SOA-3363
securityRepository.addMatch(SecurityTest.addressA, roles);
boolean failed = false;
@@ -551,12 +557,12 @@
failed = true;
}
// This was added to validate https://issues.jboss.org/browse/SOA-3363 ^^^^^
-
+
assertTrue("Failure expected on send after removing the match", failed);
-
-
+
+
session.close();
-
+
}
finally
{
@@ -672,7 +678,7 @@
senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
ClientProducer cp = senSession.createProducer(SecurityTest.addressA);
cp.send(session.createMessage(false));
- ClientConsumer cc = session.createConsumer(SecurityTest.queueA);
+ session.createConsumer(SecurityTest.queueA);
session.close();
senSession.close();
}
@@ -715,7 +721,7 @@
cp.send(session.createMessage(false));
try
{
- ClientConsumer cc = session.createConsumer(SecurityTest.queueA);
+ session.createConsumer(SecurityTest.queueA);
}
catch (HornetQException e)
{
@@ -766,7 +772,7 @@
cp.send(session.createMessage(false));
try
{
- ClientConsumer cc = session.createConsumer(SecurityTest.queueA);
+ session.createConsumer(SecurityTest.queueA);
}
catch (HornetQException e)
{
@@ -911,7 +917,7 @@
securityManager.addRole("auser", "receiver");
- ClientConsumer consumer = session.createConsumer(SecurityTest.queueA);
+ session.createConsumer(SecurityTest.queueA);
// Removing the Role... the check should be cached... but we used setSecurityInvalidationInterval(0), so the
// next createConsumer should fail
@@ -919,8 +925,8 @@
ClientSession sendingSession = cf.createSession("auser", "pass", false, false, false, false, 0);
ClientProducer prod = sendingSession.createProducer(SecurityTest.addressA);
- prod.send(createTextMessage(sendingSession, "Test", true));
- prod.send(createTextMessage(sendingSession, "Test", true));
+ prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true));
+ prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true));
try
{
sendingSession.commit();
@@ -939,8 +945,8 @@
sendingSession.start(xid, XAResource.TMNOFLAGS);
prod = sendingSession.createProducer(SecurityTest.addressA);
- prod.send(createTextMessage(sendingSession, "Test", true));
- prod.send(createTextMessage(sendingSession, "Test", true));
+ prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true));
+ prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true));
sendingSession.end(xid, XAResource.TMSUCCESS);
try
@@ -1156,7 +1162,7 @@
try
{
- ClientSession session = cf.createSession(false, true, true);
+ cf.createSession(false, true, true);
Assert.fail("should not throw exception");
}
catch (HornetQException e)
@@ -1237,7 +1243,7 @@
}
catch (HornetQException e)
{
- System.out.println("Default user cannot get a connection. Details: " + e.getMessage());
+ assertEquals("User failed to connect", HornetQException.SECURITY_EXCEPTION, e.getCode());
}
// Step 5. bill tries to make a connection using wrong password
@@ -1248,7 +1254,7 @@
}
catch (HornetQException e)
{
- System.out.println("User bill failed to connect. Details: " + e.getMessage());
+ assertEquals("User bill failed to connect", HornetQException.SECURITY_EXCEPTION, e.getCode());
}
// Step 6. bill makes a good connection.
@@ -1375,7 +1381,7 @@
}
catch (HornetQException e)
{
- System.out.println("Default user cannot get a connection. Details: " + e.getMessage());
+ assertEquals("User failed to connect", HornetQException.SECURITY_EXCEPTION, e.getCode());
}
// Step 5. bill tries to make a connection using wrong password
@@ -1386,7 +1392,7 @@
}
catch (HornetQException e)
{
- System.out.println("User bill failed to connect. Details: " + e.getMessage());
+ assertEquals("User failed to connect", HornetQException.SECURITY_EXCEPTION, e.getCode());
}
// Step 6. bill makes a good connection.
@@ -1516,7 +1522,7 @@
try
{
- ClientConsumer con = connection.createConsumer(queue);
+ connection.createConsumer(queue);
Assert.fail("should throw exception");
}
catch (HornetQException e)
@@ -1539,12 +1545,12 @@
try
{
- ClientConsumer con = connection.createConsumer(queue);
+ connection.createConsumer(queue);
Assert.fail("should throw exception");
}
catch (HornetQException e)
{
- // pass
+ Assert.assertEquals(HornetQException.SECURITY_EXCEPTION, e.getCode());
}
}
13 years, 2 months
JBoss hornetq SVN: r11571 - trunk/tests/joram-tests/src/test/java/org/hornetq/jms.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-21 10:13:48 -0400 (Fri, 21 Oct 2011)
New Revision: 11571
Modified:
trunk/tests/joram-tests/src/test/java/org/hornetq/jms/JoramAggregationTest.java
Log:
Remove non-abstract TestCase extension class causing warning failures in Maven's Surefire
Modified: trunk/tests/joram-tests/src/test/java/org/hornetq/jms/JoramAggregationTest.java
===================================================================
--- trunk/tests/joram-tests/src/test/java/org/hornetq/jms/JoramAggregationTest.java 2011-10-21 07:48:48 UTC (rev 11570)
+++ trunk/tests/joram-tests/src/test/java/org/hornetq/jms/JoramAggregationTest.java 2011-10-21 14:13:48 UTC (rev 11571)
@@ -49,7 +49,7 @@
/**
* JoramAggregationTest.
- *
+ *
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
* @version $Revision: 1.2 $
*/
@@ -60,33 +60,25 @@
super(name);
}
-
-
- /** Used to similuate tests while renaming its names. */
- private static class DummyTestCase extends TestCase
- {
- DummyTestCase(String name)
- {
- super (name);
- }
- }
-
/**
- * One of the goals of this class also is to keep original classNames into testNames. So, you will realize several proxies existent here to
- * keep these class names while executing method names.
+ * One of the goals of this class also is to keep original classNames into testNames.
+ * <p>
+ * So, you will realize several proxies existent here to keep these class names while executing
+ * method names.
*/
static class TestProxy extends TestCase
{
- Hashtable hashTests = new Hashtable();
+ Hashtable<Test, Test> hashTests = new Hashtable<Test, Test>();
+ Test testcase;
-
public TestProxy(Test testcase, String name)
{
super(name);
this.testcase = testcase;
}
- public int countTestCases()
+ @Override
+ public int countTestCases()
{
return testcase.countTestCases();
}
@@ -98,20 +90,20 @@
*/
private Test createDummyTest(Test test)
{
- Test dummyTest = (Test)hashTests.get(test);
+ Test dummyTest = hashTests.get(test);
if (dummyTest==null)
{
- if (test instanceof TestCase)
+ if (test instanceof TestCase || test instanceof TestSuite)
{
- dummyTest = new DummyTestCase(this.getName() + ":"+ ((TestCase)test).getName());
- } else
- if (test instanceof TestSuite)
+ dummyTest = new TestCase(this.getName() + ":" + ((TestCase)test).getName())
{
- dummyTest = new DummyTestCase(this.getName() + ":"+ ((TestCase)test).getName());
+ };
}
else
{
- dummyTest = new DummyTestCase(test.getClass().getName());
+ dummyTest = new TestCase(test.getClass().getName())
+ {
+ };
}
hashTests.put(test,dummyTest);
@@ -120,7 +112,8 @@
return dummyTest;
}
- public void run(final TestResult result)
+ @Override
+ public void run(final TestResult result)
{
TestResult subResult = new TestResult();
subResult.addListener(new TestListener()
@@ -151,14 +144,12 @@
});
testcase.run(subResult);
}
-
- Test testcase;
}
-
-
+
+
public static junit.framework.Test suite() throws Exception
{
TestSuite suite = new TestSuite();
@@ -181,11 +172,12 @@
suite.addTest(new TestProxy(TopicSessionTest.suite(), TopicSessionTest.class.getName()));
suite.addTest(new TestProxy(UnifiedSessionTest.suite(), UnifiedSessionTest.class.getName()));
suite.addTest(new TestProxy(TemporaryTopicTest.suite(), TemporaryTopicTest.class.getName()));
-
+
return new TestAggregation(suite);
}
+
/**
- * Should be overriden
+ * Should be overridden
* @return
*/
protected static Properties getProviderProperties() throws IOException
@@ -195,10 +187,10 @@
return props;
}
-
+
static class TestAggregation extends TestSetup
{
-
+
Admin admin;
/**
@@ -208,7 +200,8 @@
{
super(test);
}
-
+
+ @Override
public void setUp() throws Exception
{
JMSTestCase.startServer = false;
@@ -219,13 +212,13 @@
admin.startServer();
}
-
+
+ @Override
public void tearDown() throws Exception
{
- System.out.println("TearDown");
admin.stopServer();
JMSTestCase.startServer = true;
}
-
+
}
}
13 years, 2 months
JBoss hornetq SVN: r11570 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-10-21 03:48:48 -0400 (Fri, 21 Oct 2011)
New Revision: 11570
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
Log:
changed log message to debug
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-10-20 12:01:57 UTC (rev 11569)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-10-21 07:48:48 UTC (rev 11570)
@@ -130,7 +130,7 @@
TopologyMember currentMember = getMember(nodeId);
if (currentMember == null)
{
- log.warn("There's no live to be updated on backup update, node=" + nodeId + " memberInput=" + memberInput,
+ log.debug("There's no live to be updated on backup update, node=" + nodeId + " memberInput=" + memberInput,
new Exception("trace"));
currentMember = memberInput;
13 years, 2 months
JBoss hornetq SVN: r11569 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-20 08:01:57 -0400 (Thu, 20 Oct 2011)
New Revision: 11569
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/NettyConnection.java
Log:
JBPAPP-7353 Fixes[*] NettyMultiThreadRandomReattachTest hang (needs performance evaluation)
[*] It fixes a otherwise reproducible hang in a Sun 32bit JVM.
Still need verification in the reported IBM JDK case.
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/NettyConnection.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/NettyConnection.java 2011-10-20 12:01:42 UTC (rev 11568)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/NettyConnection.java 2011-10-20 12:01:57 UTC (rev 11569)
@@ -14,7 +14,8 @@
package org.hornetq.core.remoting.impl.netty;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
@@ -60,7 +61,7 @@
private volatile HornetQBuffer batchBuffer;
- private final AtomicBoolean writeLock = new AtomicBoolean(false);
+ private final Lock writeLock = new ReentrantLock();
private Set<ReadyListener> readyListeners = new ConcurrentHashSet<ReadyListener>();
@@ -152,7 +153,7 @@
return;
}
- if (writeLock.compareAndSet(false, true))
+ if (writeLock.tryLock())
{
try
{
@@ -165,7 +166,7 @@
}
finally
{
- writeLock.set(false);
+ writeLock.unlock();
}
}
}
@@ -177,11 +178,9 @@
public void write(HornetQBuffer buffer, final boolean flush, final boolean batched)
{
- while (!writeLock.compareAndSet(false, true))
- {
- Thread.yield();
- }
+ writeLock.lock();
+
try
{
if (batchBuffer == null && batchingEnabled && batched && !flush)
@@ -243,7 +242,7 @@
}
finally
{
- writeLock.set(false);
+ writeLock.unlock();
}
}
13 years, 2 months
JBoss hornetq SVN: r11568 - branches/Branch_2_2_EAP.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-20 08:01:42 -0400 (Thu, 20 Oct 2011)
New Revision: 11568
Added:
branches/Branch_2_2_EAP/.gitignore
Log:
Gitignore
Added: branches/Branch_2_2_EAP/.gitignore
===================================================================
--- branches/Branch_2_2_EAP/.gitignore (rev 0)
+++ branches/Branch_2_2_EAP/.gitignore 2011-10-20 12:01:42 UTC (rev 11568)
@@ -0,0 +1,10 @@
+/build
+/eclipse-output
+/thirdparty
+/logs
+/ObjectStore
+/tmp
+/data
+/junit*.properties
+/target
+.gitignore
\ No newline at end of file
13 years, 2 months
JBoss hornetq SVN: r11567 - trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-20 07:00:32 -0400 (Thu, 20 Oct 2011)
New Revision: 11567
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
HORNETQ-720 don't wait around if server is stopped
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-10-20 11:00:16 UTC (rev 11566)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-10-20 11:00:32 UTC (rev 11567)
@@ -2127,7 +2127,7 @@
while (true)
{
nodeManager.awaitLiveNode();
- if (quorumManager.isNodeDown())
+ if (!started || quorumManager.isNodeDown())
{
break;
}
13 years, 2 months
JBoss hornetq SVN: r11566 - in trunk/hornetq-core/src/main/java/org/hornetq/core: server/cluster/impl and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-10-20 07:00:16 -0400 (Thu, 20 Oct 2011)
New Revision: 11566
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
HORNETQ-720 Revert changes merged from 2_2_EAP (they break replication)
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-10-20 07:09:29 UTC (rev 11565)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-10-20 11:00:16 UTC (rev 11566)
@@ -312,14 +312,7 @@
throw new IllegalArgumentException("Unsupported journal type " + config.getJournalType());
}
- if (config.isBackup() && !config.isSharedStore())
- {
- idGenerator = null;
- }
- else
- {
- idGenerator = new BatchingIDGenerator(0, JournalStorageManager.CHECKPOINT_BATCH_SIZE, bindingsJournal);
- }
+ idGenerator = new BatchingIDGenerator(0, JournalStorageManager.CHECKPOINT_BATCH_SIZE, bindingsJournal);
Journal localMessage = new JournalImpl(config.getJournalFileSize(),
config.getJournalMinFiles(),
config.getJournalCompactMinFiles(),
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-20 07:09:29 UTC (rev 11565)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-20 11:00:16 UTC (rev 11566)
@@ -65,12 +65,12 @@
import org.hornetq.utils.UUID;
/**
- *
+ *
* A ClusterConnectionImpl
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author Clebert Suconic
- *
+ *
* Created 21 Jan 2009 14:43:05
*
*
@@ -142,11 +142,11 @@
private final Set<TransportConfiguration> allowableConnections = new HashSet<TransportConfiguration>();
private final ClusterManagerInternal manager;
-
-
+
+
// Stuff that used to be on the ClusterManager
-
+
private final Topology topology = new Topology(this);
private volatile ServerLocatorInternal backupServerLocator;
@@ -214,7 +214,7 @@
this.executorFactory = executorFactory;
this.executor = executorFactory.getExecutor();
-
+
this.topology.setExecutor(executor);
this.server = server;
@@ -325,7 +325,7 @@
this.executorFactory = executorFactory;
this.executor = executorFactory.getExecutor();
-
+
this.topology.setExecutor(executor);
this.server = server;
@@ -367,10 +367,10 @@
{
return;
}
-
-
+
+
started = true;
-
+
if (!backup)
{
activate();
@@ -378,7 +378,7 @@
}
}
-
+
public void flushExecutor()
{
Future future = new Future();
@@ -435,35 +435,23 @@
props);
managementService.sendNotification(notification);
}
-
- executor.execute(new Runnable()
+ if (backupServerLocator != null)
{
- public void run()
- {
- synchronized (ClusterConnectionImpl.this)
- {
- if (backupServerLocator != null)
- {
- backupServerLocator.close();
- backupServerLocator = null;
- }
+ backupServerLocator.close();
+ backupServerLocator = null;
+ }
- if (serverLocator != null)
- {
- serverLocator.close();
- serverLocator = null;
- }
- }
+ if (serverLocator != null)
+ {
+ serverLocator.close();
+ serverLocator = null;
+ }
- }
- });
-
started = false;
}
-
public void announceBackup()
{
executor.execute(new Runnable()
@@ -501,7 +489,7 @@
{
return topology.getMember(manager.getNodeId());
}
-
+
public void addClusterTopologyListener(final ClusterTopologyListener listener, final boolean clusterConnection)
{
topology.addClusterTopologyListener(listener);
@@ -519,7 +507,7 @@
{
return topology;
}
-
+
public void nodeAnnounced(final long uniqueEventID,
final String nodeID,
final Pair<TransportConfiguration, TransportConfiguration> connectorPair,
@@ -610,7 +598,7 @@
}
backup = false;
-
+
topology.updateAsLive(manager.getNodeId(), new TopologyMember(connector, null));
if (backupServerLocator != null)
@@ -831,13 +819,13 @@
}
}
}
-
+
public synchronized void informTopology()
{
String nodeID = server.getNodeID().toString();
-
+
TopologyMember localMember;
-
+
if (backup)
{
localMember = new TopologyMember(null, connector);
@@ -859,21 +847,21 @@
final boolean start) throws Exception
{
final ServerLocatorInternal targetLocator = new ServerLocatorImpl(topology, false, connector);
-
+
String nodeId;
-
+
synchronized (this)
{
if (!started)
{
return;
}
-
+
if (serverLocator == null)
{
return;
}
-
+
nodeId = serverLocator.getNodeID();
}
13 years, 2 months
JBoss hornetq SVN: r11565 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-10-20 03:09:29 -0400 (Thu, 20 Oct 2011)
New Revision: 11565
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
removed loop for annoncing backup
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-19 21:03:14 UTC (rev 11564)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-20 07:09:29 UTC (rev 11565)
@@ -470,33 +470,29 @@
{
public void run()
{
- while (true)
+ try
{
- try
- {
- if (log.isDebugEnabled())
- {
- log.debug(ClusterConnectionImpl.this + ":: announcing " + connector + " to " + backupServerLocator);
- }
- ClientSessionFactory backupSessionFactory = backupServerLocator.connect();
- if (backupSessionFactory != null)
- {
- backupSessionFactory.getConnection()
- .getChannel(0, -1)
- .send(new NodeAnnounceMessage(System.currentTimeMillis(),
- nodeUUID.toString(),
- true,
- connector,
- null));
- log.info("backup announced");
- break;
- }
- }
- catch (Exception e)
- {
- log.warn("Unable to announce backup, retrying", e);
- }
+ if (log.isDebugEnabled())
+ {
+ log.debug(ClusterConnectionImpl.this + ":: announcing " + connector + " to " + backupServerLocator);
+ }
+ ClientSessionFactory backupSessionFactory = backupServerLocator.connect();
+ if (backupSessionFactory != null)
+ {
+ backupSessionFactory.getConnection()
+ .getChannel(0, -1)
+ .send(new NodeAnnounceMessage(System.currentTimeMillis(),
+ nodeUUID.toString(),
+ true,
+ connector,
+ null));
+ log.info("backup announced");
+ }
}
+ catch (Exception e)
+ {
+ log.warn("Unable to announce backup, retrying", e);
+ }
}
});
}
13 years, 2 months