You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/06/15 06:52:37 UTC
[1/2] activemq-artemis git commit: ARTEMIS-103 Changed
JGroupsBroadcastEndpoint to not close its JChannel since its externally
managed. Added javadocs to impacted areas to clarify that the JChannel is not
closed by these implementations.
Repository: activemq-artemis
Updated Branches:
refs/heads/master 29d59e970 -> 9687c4003
ARTEMIS-103 Changed JGroupsBroadcastEndpoint to not close its JChannel since its externally managed. Added javadocs to impacted areas to clarify that the JChannel is not closed by these implementations.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3710b3aa
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3710b3aa
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3710b3aa
Branch: refs/heads/master
Commit: 3710b3aa3c81d3628b3ba4d209cd06d393becf65
Parents: 29d59e9
Author: John D. Ament <jo...@apache.org>
Authored: Sun Jun 14 19:59:28 2015 -0400
Committer: John D. Ament <jo...@apache.org>
Committed: Sun Jun 14 19:59:28 2015 -0400
----------------------------------------------------------------------
.../api/core/ChannelBroadcastEndpointFactory.java | 5 +++++
.../artemis/api/core/JGroupsBroadcastEndpoint.java | 9 +++++++++
.../api/core/JGroupsChannelBroadcastEndpoint.java | 11 +++++++++++
.../ConnectionFactoryWithJGroupsSerializationTest.java | 7 +++++++
4 files changed, 32 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3710b3aa/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java
index a5cfee0..69f22de 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java
@@ -18,6 +18,11 @@ package org.apache.activemq.artemis.api.core;
import org.jgroups.JChannel;
+/**
+ * An implementation of BroadcastEndpointFactory that uses an externally managed JChannel for JGroups clustering.
+ *
+ * Note - the underlying JChannel is not closed in this implementation.
+ */
public class ChannelBroadcastEndpointFactory implements BroadcastEndpointFactory
{
private final JChannel channel;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3710b3aa/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java
index d1af492..8693095 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java
@@ -126,6 +126,15 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint
channel.removeReceiver(receiver);
clientOpened = false;
}
+ internalCloseChannel();
+ }
+
+ /**
+ * Closes the channel used in this JGroups Broadcast.
+ * Can be overridden by implementations that use an externally managed channel.
+ */
+ protected synchronized void internalCloseChannel()
+ {
channel.close();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3710b3aa/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsChannelBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsChannelBroadcastEndpoint.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsChannelBroadcastEndpoint.java
index 5f517d3..cb85b8d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsChannelBroadcastEndpoint.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsChannelBroadcastEndpoint.java
@@ -18,6 +18,11 @@ package org.apache.activemq.artemis.api.core;
import org.jgroups.JChannel;
+/**
+ * An implementation of JGroupsBroadcastEndpoint that uses an externally managed JChannel for its operations.
+ *
+ * Note - this implementation does not close the JChannel, since its externally created.
+ */
public class JGroupsChannelBroadcastEndpoint extends JGroupsBroadcastEndpoint
{
private final JChannel jChannel;
@@ -33,4 +38,10 @@ public class JGroupsChannelBroadcastEndpoint extends JGroupsBroadcastEndpoint
{
return jChannel;
}
+
+ @Override
+ protected synchronized void internalCloseChannel()
+ {
+ // no-op, this version takes an externally managed channel.
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3710b3aa/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
index be8452f..4b58ee1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
@@ -25,6 +25,7 @@ import java.io.Serializable;
import javax.jms.Queue;
+import org.apache.activemq.artemis.api.core.BroadcastEndpoint;
import org.apache.activemq.artemis.api.core.BroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
@@ -171,8 +172,14 @@ public class ConnectionFactoryWithJGroupsSerializationTest extends JMSTestBase
@After
public void tearDown() throws Exception
{
+ // small hack, the channel here is cached, so checking that it's not closed by any endpoint
+ BroadcastEndpoint broadcastEndpoint = jmsServer.getActiveMQServer().getConfiguration()
+ .getDiscoveryGroupConfigurations().get("dg1")
+ .getBroadcastEndpointFactory().createBroadcastEndpoint();
+ broadcastEndpoint.close(true);
if (channel != null)
{
+ assertFalse(channel.isClosed());
channel.close();
}
[2/2] activemq-artemis git commit: This closes #27 JGroups Close
Channel
Posted by cl...@apache.org.
This closes #27 JGroups Close Channel
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/9687c400
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/9687c400
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/9687c400
Branch: refs/heads/master
Commit: 9687c4003d7d839bb0f2f4f5eeb13427a053819d
Parents: 29d59e9 3710b3a
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jun 15 00:52:26 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jun 15 00:52:26 2015 -0400
----------------------------------------------------------------------
.../api/core/ChannelBroadcastEndpointFactory.java | 5 +++++
.../artemis/api/core/JGroupsBroadcastEndpoint.java | 9 +++++++++
.../api/core/JGroupsChannelBroadcastEndpoint.java | 11 +++++++++++
.../ConnectionFactoryWithJGroupsSerializationTest.java | 7 +++++++
4 files changed, 32 insertions(+)
----------------------------------------------------------------------