JBoss hornetq SVN: r10179 - branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/recovery.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-04 10:03:29 -0500 (Fri, 04 Feb 2011)
New Revision: 10179
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java
Log:
https://issues.jboss.org/browse/JBPAPP-5080 - ignore warning for xa resource locator
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java 2011-02-04 14:56:35 UTC (rev 10178)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java 2011-02-04 15:03:29 UTC (rev 10179)
@@ -281,6 +281,7 @@
TransportConfiguration config = new TransportConfiguration(connectorFactoryClassName, connectorConfig);
serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration[]{config});
+ serverLocator.disableFinalizeCheck();
csf = serverLocator.createSessionFactory();
ClientSession cs = null;
13 years, 11 months
JBoss hornetq SVN: r10178 - in branches/Branch_2_2_EAP/src: config/jboss-as-4/clustered and 2 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-04 09:56:35 -0500 (Fri, 04 Feb 2011)
New Revision: 10178
Modified:
branches/Branch_2_2_EAP/src/config/jboss-as-4/clustered/ra.xml
branches/Branch_2_2_EAP/src/config/jboss-as-4/non-clustered/ra.xml
branches/Branch_2_2_EAP/src/config/ra.xml
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnectionFactory.java
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
Log:
https://issues.jboss.org/browse/JBPAPP-5791 - updated example ra and removed some unwanted methods
Modified: branches/Branch_2_2_EAP/src/config/jboss-as-4/clustered/ra.xml
===================================================================
--- branches/Branch_2_2_EAP/src/config/jboss-as-4/clustered/ra.xml 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/config/jboss-as-4/clustered/ra.xml 2011-02-04 14:56:35 UTC (rev 10178)
@@ -70,8 +70,20 @@
<config-property-type>java.lang.String</config-property-type>
<config-property-value>getTm</config-property-value>
</config-property>
- <!--
+ <!--
<config-property>
+ <description>Does we support HA</description>
+ <config-property-name>HA</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ <config-property-value>false</config-property-value>
+ </config-property>
+ <config-property>
+ <description>The method to use for locating the transactionmanager</description>
+ <config-property-name>TransactionManagerLocatorMethod</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>getTm</config-property-value>
+ </config-property>
+ <config-property>
<description>Use A local Transaction instead of XA?</description>
<config-property-name>UseLocalTx</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
@@ -90,26 +102,14 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The Backup transport type</description>
- <config-property-name>BackUpTransportType</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
- <description>The Backup transport configuration. These values must be in the form of key=val;key=val;</description>
- <config-property-name>TransportConfiguration</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The discovery group address</description>
- <config-property-name>DiscoveryGroupAddress</config-property-name>
+ <config-property-name>DiscoveryAddress</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value></config-property-value>
</config-property>
<config-property>
<description>The discovery group port</description>
- <config-property-name>DiscoveryGroupPort</config-property-name>
+ <config-property-name>DiscoveryPort</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -174,8 +174,8 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The producer window size</description>
- <config-property-name>ProducerWindowSize</config-property-name>
+ <description>The confirmation window size</description>
+ <config-property-name>ConfirmationWindowSize</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -216,7 +216,7 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The max connections</description>
+ <description>The max connections</description>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -239,12 +239,6 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>Should clean server shutdown trigger failover?</description>
- <config-property-name>FailoverOnServerShutdown</config-property-name>
- <config-property-type>java.lang.Boolean</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The client id</description>
<config-property-name>ClientID</config-property-name>
<config-property-type>java.lang.String</config-property-type>
Modified: branches/Branch_2_2_EAP/src/config/jboss-as-4/non-clustered/ra.xml
===================================================================
--- branches/Branch_2_2_EAP/src/config/jboss-as-4/non-clustered/ra.xml 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/config/jboss-as-4/non-clustered/ra.xml 2011-02-04 14:56:35 UTC (rev 10178)
@@ -70,8 +70,20 @@
<config-property-type>java.lang.String</config-property-type>
<config-property-value>getTm</config-property-value>
</config-property>
- <!--
+ <!--
<config-property>
+ <description>Does we support HA</description>
+ <config-property-name>HA</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ <config-property-value>false</config-property-value>
+ </config-property>
+ <config-property>
+ <description>The method to use for locating the transactionmanager</description>
+ <config-property-name>TransactionManagerLocatorMethod</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>getTm</config-property-value>
+ </config-property>
+ <config-property>
<description>Use A local Transaction instead of XA?</description>
<config-property-name>UseLocalTx</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
@@ -90,26 +102,14 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The Backup transport type</description>
- <config-property-name>BackUpTransportType</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
- <description>The Backup transport configuration. These values must be in the form of key=val;key=val;</description>
- <config-property-name>TransportConfiguration</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The discovery group address</description>
- <config-property-name>DiscoveryGroupAddress</config-property-name>
+ <config-property-name>DiscoveryAddress</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value></config-property-value>
</config-property>
<config-property>
<description>The discovery group port</description>
- <config-property-name>DiscoveryGroupPort</config-property-name>
+ <config-property-name>DiscoveryPort</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -174,8 +174,8 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The producer window size</description>
- <config-property-name>ProducerWindowSize</config-property-name>
+ <description>The confirmation window size</description>
+ <config-property-name>ConfirmationWindowSize</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -198,7 +198,7 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The block on non-durable send</description>
+ <description>The block on non durable send</description>
<config-property-name>BlockOnNonDurableSend</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value></config-property-value>
@@ -216,7 +216,7 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The max connections</description>
+ <description>The max connections</description>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -239,12 +239,6 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>Should clean server shutdown trigger failover?</description>
- <config-property-name>FailoverOnServerShutdown</config-property-name>
- <config-property-type>java.lang.Boolean</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The client id</description>
<config-property-name>ClientID</config-property-name>
<config-property-type>java.lang.String</config-property-type>
Modified: branches/Branch_2_2_EAP/src/config/ra.xml
===================================================================
--- branches/Branch_2_2_EAP/src/config/ra.xml 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/config/ra.xml 2011-02-04 14:56:35 UTC (rev 10178)
@@ -47,6 +47,12 @@
</config-property>
<!--
<config-property>
+ <description>Does we support HA</description>
+ <config-property-name>HA</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ <config-property-value>false</config-property-value>
+ </config-property>
+ <config-property>
<description>The method to use for locating the transactionmanager</description>
<config-property-name>TransactionManagerLocatorMethod</config-property-name>
<config-property-type>java.lang.String</config-property-type>
@@ -71,26 +77,14 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>The Backup transport type</description>
- <config-property-name>BackUpTransportType</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
- <description>The Backup transport configuration. These values must be in the form of key=val;key=val;</description>
- <config-property-name>TransportConfiguration</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The discovery group address</description>
- <config-property-name>DiscoveryGroupAddress</config-property-name>
+ <config-property-name>DiscoveryAddress</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value></config-property-value>
</config-property>
<config-property>
<description>The discovery group port</description>
- <config-property-name>DiscoveryGroupPort</config-property-name>
+ <config-property-name>DiscoveryPort</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value></config-property-value>
</config-property>
@@ -220,12 +214,6 @@
<config-property-value></config-property-value>
</config-property>
<config-property>
- <description>Should clean server shutdown trigger failover?</description>
- <config-property-name>FailoverOnServerShutdown</config-property-name>
- <config-property-type>java.lang.Boolean</config-property-type>
- <config-property-value></config-property-value>
- </config-property>
- <config-property>
<description>The client id</description>
<config-property-name>ClientID</config-property-name>
<config-property-type>java.lang.String</config-property-type>
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java 2011-02-04 14:56:35 UTC (rev 10178)
@@ -95,8 +95,6 @@
private Integer reconnectAttempts = -1;
- private Boolean failoverOnServerShutdown;
-
private Boolean useGlobalPools;
private Integer scheduledThreadPoolMaxSize;
@@ -624,26 +622,6 @@
this.reconnectAttempts = reconnectAttempts;
}
- public Boolean isFailoverOnServerShutdown()
- {
- if (ConnectionFactoryProperties.trace)
- {
- ConnectionFactoryProperties.log.trace("isFailoverOnServerShutdown()");
- }
- hasBeenUpdated = true;
- return failoverOnServerShutdown;
- }
-
- public void setFailoverOnServerShutdown(final Boolean failoverOnServerShutdown)
- {
- if (ConnectionFactoryProperties.trace)
- {
- ConnectionFactoryProperties.log.trace("setFailoverOnServerShutdown(" + failoverOnServerShutdown + ")");
- }
- hasBeenUpdated = true;
- this.failoverOnServerShutdown = failoverOnServerShutdown;
- }
-
public Boolean isUseGlobalPools()
{
if (ConnectionFactoryProperties.trace)
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnectionFactory.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnectionFactory.java 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnectionFactory.java 2011-02-04 14:56:35 UTC (rev 10178)
@@ -650,16 +650,6 @@
mcfProperties.setReconnectAttempts(reconnectAttempts);
}
- public Boolean isFailoverOnServerShutdown()
- {
- return mcfProperties.isFailoverOnServerShutdown();
- }
-
- public void setFailoverOnServerShutdown(final Boolean failoverOnServerShutdown)
- {
- mcfProperties.setFailoverOnServerShutdown(failoverOnServerShutdown);
- }
-
public Boolean isUseGlobalPools()
{
return mcfProperties.isUseGlobalPools();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-02-04 14:38:32 UTC (rev 10177)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-02-04 14:56:35 UTC (rev 10178)
@@ -260,6 +260,17 @@
}
}
+
+ public Boolean getHA()
+ {
+ return raProperties.isHA();
+ }
+
+ public void setHA(final Boolean ha)
+ {
+ this.raProperties.setHA(ha);
+ }
+
/**
* Get the discovery group name
*
@@ -319,16 +330,6 @@
raProperties.setDiscoveryPort(dgp);
}
-
- public Boolean isHA()
- {
- return raProperties.isHA();
- }
-
- public void setHA(final Boolean ha)
- {
- this.raProperties.setHA(ha);
- }
/**
* Get discovery refresh timeout
@@ -960,46 +961,6 @@
raProperties.setReconnectAttempts(reconnectAttempts);
}
- /**
- * Get failover on server shutdown
- *
- * @return The value
- */
- public Boolean isFailoverOnServerShutdown()
- {
- if (HornetQResourceAdapter.trace)
- {
- HornetQResourceAdapter.log.trace("isFailoverOnServerShutdown()");
- }
-
- return raProperties.isFailoverOnServerShutdown();
- }
-
- /**
- * Get failover on server shutdown
- *
- * @return The value
- */
- public Boolean getFailoverOnServerShutdown()
- {
- return isFailoverOnServerShutdown();
- }
-
- /**
- * Set failover on server shutdown
- *
- * @param failoverOnServerShutdown The value
- */
- public void setFailoverOnServerShutdown(final Boolean failoverOnServerShutdown)
- {
- if (HornetQResourceAdapter.trace)
- {
- HornetQResourceAdapter.log.trace("setFailoverOnServerShutdown(" + failoverOnServerShutdown + ")");
- }
-
- raProperties.setFailoverOnServerShutdown(failoverOnServerShutdown);
- }
-
public String getConnectionLoadBalancingPolicyClassName()
{
return raProperties.getConnectionLoadBalancingPolicyClassName();
@@ -1383,7 +1344,7 @@
String discoveryAddress = overrideProperties.getDiscoveryAddress() != null ? overrideProperties.getDiscoveryAddress()
: getDiscoveryAddress();
- Boolean ha = overrideProperties.isHA() != null ? overrideProperties.isHA() : isHA();
+ Boolean ha = overrideProperties.isHA() != null ? overrideProperties.isHA() : getHA();
if (connectorClassName != null)
{
13 years, 11 months
JBoss hornetq SVN: r10177 - in branches/Branch_2_2_EAP: examples-eap and 5 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-04 09:38:32 -0500 (Fri, 04 Feb 2011)
New Revision: 10177
Added:
branches/Branch_2_2_EAP/examples-eap/
branches/Branch_2_2_EAP/examples-eap/common/
branches/Branch_2_2_EAP/examples-eap/common/config/
branches/Branch_2_2_EAP/examples-eap/common/config/ant.properties
branches/Branch_2_2_EAP/examples-eap/javaee/
branches/Branch_2_2_EAP/examples-eap/javaee/common/
branches/Branch_2_2_EAP/examples-eap/javaee/common/config/
branches/Branch_2_2_EAP/examples-eap/javaee/common/config/ant.properties
branches/Branch_2_2_EAP/examples-eap/readme
Modified:
branches/Branch_2_2_EAP/build-hornetq.xml
Log:
https://issues.jboss.org/browse/JBPAPP-5593 - added changes for eap examples
Modified: branches/Branch_2_2_EAP/build-hornetq.xml
===================================================================
--- branches/Branch_2_2_EAP/build-hornetq.xml 2011-02-03 22:17:34 UTC (rev 10176)
+++ branches/Branch_2_2_EAP/build-hornetq.xml 2011-02-04 14:38:32 UTC (rev 10177)
@@ -775,7 +775,7 @@
</target>
<target name="jar"
- depends="jar-core, jar-core-client, jar-core-client-java5, jar-jms, jar-jms-client, jar-jms-client-java5, jar-jboss-integration, jar-jboss-service, jar-bootstrap, jar-logging, jar-ra, jar-mc, jar-jnp-client, jar-resources, sources-jar, jar-twitter-integration, jar-spring-integration, jar-rest">
+ depends="jar-core, jar-core-client, jar-core-client-java5, jar-jms, jar-jms-client, jar-jms-client-java5, jar-jboss-integration, jar-jboss-service, jar-bootstrap, jar-logging, jar-ra, jar-mc, jar-jnp-client, jar-resources, sources-jar, jar-twitter-integration, jar-spring-integration, jar-rest, eap-examples">
</target>
<target name="jar-jnp-client" depends="init">
Added: branches/Branch_2_2_EAP/examples-eap/common/config/ant.properties
===================================================================
--- branches/Branch_2_2_EAP/examples-eap/common/config/ant.properties (rev 0)
+++ branches/Branch_2_2_EAP/examples-eap/common/config/ant.properties 2011-02-04 14:38:32 UTC (rev 10177)
@@ -0,0 +1,18 @@
+#
+# Copyright 2009 Red Hat, Inc.
+# Red Hat licenses this file to you under the Apache License, version
+# 2.0 (the "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+hornetq.example.logserveroutput=true
+hornetq.jars.dir=${ENV.JBOSS_HOME}/common/lib
+jars.dir=${ENV.JBOSS_HOME}/lib
+aio.library.path=${ENV.JBOSS_HOME}/common/lib
+jms-library=jboss-javaee.jar
Added: branches/Branch_2_2_EAP/examples-eap/javaee/common/config/ant.properties
===================================================================
Added: branches/Branch_2_2_EAP/examples-eap/readme
===================================================================
--- branches/Branch_2_2_EAP/examples-eap/readme (rev 0)
+++ branches/Branch_2_2_EAP/examples-eap/readme 2011-02-04 14:38:32 UTC (rev 10177)
@@ -0,0 +1 @@
+This directory contains files that will be used to replace files in order to make the examples runnable on the EAP
13 years, 11 months
JBoss hornetq SVN: r10176 - in branches/Branch_2_2_EAP: src/main/org/hornetq/api/core/management and 13 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-03 17:17:34 -0500 (Thu, 03 Feb 2011)
New Revision: 10176
Modified:
branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressSettingsInfo.java
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCache.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCursorProvider.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagePosition.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PagePositionImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/AddressSettings.java
branches/Branch_2_2_EAP/src/main/org/hornetq/utils/SoftValueHashMap.java
branches/Branch_2_2_EAP/tests/config/ConfigurationTest-full-config.xml
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingOrderTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/util/SoftValueMapTest.java
Log:
Adding page-max-cache-size as a parameter on address settings
Modified: branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd 2011-02-03 22:17:34 UTC (rev 10176)
@@ -473,6 +473,8 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="page-size-bytes" type="xsd:long">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0" name="page-max-cache-size" type="xsd:int">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="address-full-policy" type="addressFullMessagePolicyType">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="message-counter-history-day-limit" type="xsd:int">
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressSettingsInfo.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressSettingsInfo.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressSettingsInfo.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -34,6 +34,8 @@
private long maxSizeBytes;
private int pageSizeBytes;
+
+ private int pageCacheMaxSize;
private int maxDeliveryAttempts;
@@ -57,6 +59,7 @@
return new AddressSettingsInfo(object.getString("addressFullMessagePolicy"),
object.getLong("maxSizeBytes"),
object.getInt("pageSizeBytes"),
+ object.getInt("pageCacheMaxSize"),
object.getInt("maxDeliveryAttempts"),
object.getLong("redeliveryDelay"),
object.getString("DLA"),
@@ -71,6 +74,7 @@
public AddressSettingsInfo(String addressFullMessagePolicy,
long maxSizeBytes,
int pageSizeBytes,
+ int pageCacheMaxSize,
int maxDeliveryAttempts,
long redeliveryDelay,
String deadLetterAddress,
@@ -82,6 +86,7 @@
this.addressFullMessagePolicy = addressFullMessagePolicy;
this.maxSizeBytes = maxSizeBytes;
this.pageSizeBytes = pageSizeBytes;
+ this.pageCacheMaxSize = pageCacheMaxSize;
this.maxDeliveryAttempts = maxDeliveryAttempts;
this.redeliveryDelay = redeliveryDelay;
this.deadLetterAddress = deadLetterAddress;
@@ -93,6 +98,16 @@
// Public --------------------------------------------------------
+ public int getPageCacheMaxSize()
+ {
+ return pageCacheMaxSize;
+ }
+
+ public void setPageCacheMaxSize(int pageCacheMaxSize)
+ {
+ this.pageCacheMaxSize = pageCacheMaxSize;
+ }
+
public String getAddressFullMessagePolicy()
{
return addressFullMessagePolicy;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -535,6 +535,7 @@
@Parameter(desc="the delivery attempts", name="deliveryAttempts") int deliveryAttempts,
@Parameter(desc="the max size in bytes", name="maxSizeBytes") long maxSizeBytes,
@Parameter(desc="the page size in bytes", name="pageSizeBytes") int pageSizeBytes,
+ @Parameter(desc="the max number of pages in the soft memory cache", name="pageMaxCacheSize") int pageMaxCacheSize,
@Parameter(desc="the redelivery delay", name="redeliveryDelay") long redeliveryDelay,
@Parameter(desc="the redistribution delay", name="redistributionDelay") long redistributionDelay,
@Parameter(desc="do we send to the DLA when there is no where to route the message", name="sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute,
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -108,6 +108,8 @@
private static final String PAGE_SIZE_BYTES_NODE_NAME = "page-size-bytes";
+ private static final String PAGE_MAX_CACHE_SIZE_NODE_NAME = "page-max-cache-size";
+
private static final String MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME = "message-counter-history-day-limit";
private static final String LVQ_NODE_NAME = "last-value-queue";
@@ -778,6 +780,10 @@
{
addressSettings.setPageSizeBytes(Long.valueOf(child.getTextContent()));
}
+ else if (FileConfigurationParser.PAGE_MAX_CACHE_SIZE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ addressSettings.setPageCacheMaxSize(Integer.valueOf(child.getTextContent()));
+ }
else if (FileConfigurationParser.MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
{
addressSettings.setMessageCounterHistoryDayLimit(Integer.valueOf(child.getTextContent()));
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -1489,6 +1489,7 @@
settings.put("expiryAddress", addressSettings.getExpiryAddress());
}
settings.put("maxDeliveryAttempts", addressSettings.getMaxDeliveryAttempts());
+ settings.put("pageCacheMaxSize", addressSettings.getPageCacheMaxSize());
settings.put("maxSizeBytes", addressSettings.getMaxSizeBytes());
settings.put("pageSizeBytes", addressSettings.getPageSizeBytes());
settings.put("redeliveryDelay", addressSettings.getRedeliveryDelay());
@@ -1504,13 +1505,15 @@
return jsonObject.toString();
}
- public void addAddressSettings(final String address,
+
+ public void addAddressSettings(final String address,
final String DLA,
final String expiryAddress,
final boolean lastValueQueue,
final int deliveryAttempts,
final long maxSizeBytes,
final int pageSizeBytes,
+ final int pageMaxCacheSize,
final long redeliveryDelay,
final long redistributionDelay,
final boolean sendToDLAOnNoRoute,
@@ -1523,6 +1526,7 @@
addressSettings.setExpiryAddress(expiryAddress == null ? null : new SimpleString(expiryAddress));
addressSettings.setLastValueQueue(lastValueQueue);
addressSettings.setMaxDeliveryAttempts(deliveryAttempts);
+ addressSettings.setPageCacheMaxSize(pageMaxCacheSize);
addressSettings.setMaxSizeBytes(maxSizeBytes);
addressSettings.setPageSizeBytes(pageSizeBytes);
addressSettings.setRedeliveryDelay(redeliveryDelay);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCache.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCache.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCache.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -15,6 +15,7 @@
import org.hornetq.core.paging.Page;
import org.hornetq.core.paging.PagedMessage;
+import org.hornetq.utils.SoftValueHashMap;
/**
* A PageCache
@@ -23,7 +24,7 @@
*
*
*/
-public interface PageCache
+public interface PageCache extends SoftValueHashMap.ValueCache
{
Page getPage();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCursorProvider.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCursorProvider.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PageCursorProvider.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -66,6 +66,10 @@
// Perform the cleanup at the caller's thread (for startup and recovery)
void cleanup();
+
+ int getCacheMaxSize();
+
+ void setCacheMaxSize(int size);
/**
* @param pageCursorImpl
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagePosition.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagePosition.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagePosition.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -35,15 +35,6 @@
int getMessageNr();
- void setPageCache(PageCache pageCache);
-
- /**
- * PagePosition will hold the page with a weak reference.
- * So, this could be eventually null case soft-cache was released
- * @return
- */
- PageCache getPageCache();
-
PagePosition nextMessage();
PagePosition nextPage();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -62,9 +62,9 @@
private final Executor executor;
- private Map<Long, PageCache> softCache = new SoftValueHashMap<Long, PageCache>();
+ private final SoftValueHashMap<Long, PageCache> softCache;
- private ConcurrentMap<Long, PageSubscription> activeCursors = new ConcurrentHashMap<Long, PageSubscription>();
+ private final ConcurrentMap<Long, PageSubscription> activeCursors = new ConcurrentHashMap<Long, PageSubscription>();
// Static --------------------------------------------------------
@@ -72,12 +72,14 @@
public PageCursorProviderImpl(final PagingStore pagingStore,
final StorageManager storageManager,
- final ExecutorFactory executorFactory)
+ final ExecutorFactory executorFactory,
+ final int maxCacheSize)
{
this.pagingStore = pagingStore;
this.storageManager = storageManager;
this.executorFactory = executorFactory;
this.executor = executorFactory.getExecutor();
+ this.softCache = new SoftValueHashMap<Long, PageCache>(maxCacheSize);
}
// Public --------------------------------------------------------
@@ -96,12 +98,12 @@
}
activeCursor = new PageSubscriptionImpl(this,
- pagingStore,
- storageManager,
- executorFactory.getExecutor(),
- filter,
- cursorID,
- persistent);
+ pagingStore,
+ storageManager,
+ executorFactory.getExecutor(),
+ filter,
+ cursorID,
+ persistent);
activeCursors.put(cursorID, activeCursor);
return activeCursor;
}
@@ -126,8 +128,10 @@
return cache.getMessage(pos.getMessageNr());
}
-
- public PagedReference newReference(final PagePosition pos, final PagedMessage msg, final PageSubscription subscription)
+
+ public PagedReference newReference(final PagePosition pos,
+ final PagedMessage msg,
+ final PageSubscription subscription)
{
return new PagedReferenceImpl(pos, msg, subscription);
}
@@ -137,13 +141,7 @@
*/
public PageCache getPageCache(PagePosition pos)
{
- PageCache cache = pos.getPageCache();
- if (cache == null)
- {
- cache = getPageCache(pos.getPageNr());
- pos.setPageCache(cache);
- }
- return cache;
+ return getPageCache(pos.getPageNr());
}
public void addPageCache(PageCache cache)
@@ -154,6 +152,16 @@
}
}
+ public int getCacheMaxSize()
+ {
+ return softCache.getMaxEelements();
+ }
+
+ public void setCacheMaxSize(final int size)
+ {
+ softCache.setMaxElements(size);
+ }
+
public int getCacheSize()
{
synchronized (softCache)
@@ -245,7 +253,7 @@
{
return;
}
-
+
if (pagingStore.getNumberOfPages() == 0)
{
return;
@@ -255,7 +263,7 @@
cursorList.addAll(activeCursors.values());
long minPage = checkMinPage(cursorList);
-
+
if (minPage == pagingStore.getCurrentWritingPage() && pagingStore.getCurrentPage().getNumberOfMessages() > 0)
{
boolean complete = true;
@@ -272,7 +280,8 @@
if (complete)
{
- log.info("Address " + pagingStore.getAddress() + " is leaving page mode as all messages are consumed and acknowledged from the page store");
+ log.info("Address " + pagingStore.getAddress() +
+ " is leaving page mode as all messages are consumed and acknowledged from the page store");
pagingStore.forceAnotherPage();
Page currentPage = pagingStore.getCurrentPage();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PagePositionImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PagePositionImpl.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PagePositionImpl.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -33,9 +33,7 @@
/** ID used for storage */
private long recordID;
-
- private volatile WeakReference<PageCache> cacheReference;
-
+
/**
* @param pageNr
* @param messageNr
@@ -47,12 +45,6 @@
this.messageNr = messageNr;
}
- public PagePositionImpl(long pageNr, int messageNr, PageCache pageCache)
- {
- this(pageNr, messageNr);
- this.setPageCache(pageCache);
- }
-
/**
* @param pageNr
* @param messageNr
@@ -63,31 +55,6 @@
}
/**
- * The cached page associaed with this position
- * @return
- */
- public PageCache getPageCache()
- {
- if (cacheReference == null)
- {
- return null;
- }
- else
- {
- return cacheReference.get();
- }
- }
-
- public void setPageCache(final PageCache cache)
- {
- if (cache != null)
- {
- this.cacheReference = new WeakReference<PageCache>(cache);
- }
- }
-
-
- /**
* @return the recordID
*/
public long getRecordID()
@@ -153,7 +120,7 @@
public PagePosition nextMessage()
{
- return new PagePositionImpl(this.pageNr, this.messageNr + 1, this.getPageCache());
+ return new PagePositionImpl(this.pageNr, this.messageNr + 1);
}
public PagePosition nextPage()
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -199,7 +199,7 @@
this.syncTimer = null;
}
- this.cursorProvider = new PageCursorProviderImpl(this, this.storageManager, executorFactory);
+ this.cursorProvider = new PageCursorProviderImpl(this, this.storageManager, executorFactory, addressSettings.getPageCacheMaxSize());
}
@@ -213,6 +213,11 @@
pageSize = addressSettings.getPageSizeBytes();
addressFullMessagePolicy = addressSettings.getAddressFullMessagePolicy();
+
+ if (cursorProvider != null)
+ {
+ cursorProvider.setCacheMaxSize(addressSettings.getPageCacheMaxSize());
+ }
}
// Public --------------------------------------------------------
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/AddressSettings.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -44,6 +44,8 @@
public static final long DEFAULT_PAGE_SIZE = 10 * 1024 * 1024;
public static final int DEFAULT_MAX_DELIVERY_ATTEMPTS = 10;
+
+ public static final int DEFAULT_PAGE_MAX_CACHE = 5;
public static final int DEFAULT_MESSAGE_COUNTER_HISTORY_DAY_LIMIT = 0;
@@ -60,6 +62,8 @@
private Long maxSizeBytes = null;
private Long pageSizeBytes = null;
+
+ private Integer pageMaxCache = null;
private Boolean dropMessagesWhenFull = null;
@@ -109,6 +113,16 @@
{
pageSizeBytes = pageSize;
}
+
+ public int getPageCacheMaxSize()
+ {
+ return pageMaxCache != null ? pageMaxCache : AddressSettings.DEFAULT_PAGE_MAX_CACHE;
+ }
+
+ public void setPageCacheMaxSize(final int pageMaxCache)
+ {
+ this.pageMaxCache = pageMaxCache;
+ }
public long getMaxSizeBytes()
{
@@ -209,6 +223,10 @@
{
maxSizeBytes = merged.maxSizeBytes;
}
+ if (pageMaxCache == null)
+ {
+ pageMaxCache = merged.pageMaxCache;
+ }
if (pageSizeBytes == null)
{
pageSizeBytes = merged.getPageSizeBytes();
@@ -262,6 +280,8 @@
maxSizeBytes = BufferHelper.readNullableLong(buffer);
pageSizeBytes = BufferHelper.readNullableLong(buffer);
+
+ pageMaxCache = BufferHelper.readNullableInteger(buffer);
dropMessagesWhenFull = BufferHelper.readNullableBoolean(buffer);
@@ -291,6 +311,7 @@
return BufferHelper.sizeOfNullableSimpleString(addressFullMessagePolicy != null ? addressFullMessagePolicy.toString()
: null) + BufferHelper.sizeOfNullableLong(maxSizeBytes) +
BufferHelper.sizeOfNullableLong(pageSizeBytes) +
+ BufferHelper.sizeOfNullableInteger(pageMaxCache) +
BufferHelper.sizeOfNullableBoolean(dropMessagesWhenFull) +
BufferHelper.sizeOfNullableInteger(maxDeliveryAttempts) +
BufferHelper.sizeOfNullableInteger(messageCounterHistoryDayLimit) +
@@ -314,6 +335,8 @@
BufferHelper.writeNullableLong(buffer, pageSizeBytes);
+ BufferHelper.writeNullableInteger(buffer, pageMaxCache);
+
BufferHelper.writeNullableBoolean(buffer, dropMessagesWhenFull);
BufferHelper.writeNullableInteger(buffer, maxDeliveryAttempts);
@@ -351,6 +374,7 @@
result = prime * result +
((messageCounterHistoryDayLimit == null) ? 0 : messageCounterHistoryDayLimit.hashCode());
result = prime * result + ((pageSizeBytes == null) ? 0 : pageSizeBytes.hashCode());
+ result = prime * result + ((pageMaxCache == null) ? 0 : pageMaxCache.hashCode());
result = prime * result + ((redeliveryDelay == null) ? 0 : redeliveryDelay.hashCode());
result = prime * result + ((redistributionDelay == null) ? 0 : redistributionDelay.hashCode());
result = prime * result + ((sendToDLAOnNoRoute == null) ? 0 : sendToDLAOnNoRoute.hashCode());
@@ -433,6 +457,13 @@
}
else if (!pageSizeBytes.equals(other.pageSizeBytes))
return false;
+ if (pageMaxCache == null)
+ {
+ if (other.pageMaxCache != null)
+ return false;
+ }
+ else if (!pageMaxCache.equals(other.pageMaxCache))
+ return false;
if (redeliveryDelay == null)
{
if (other.redeliveryDelay != null)
@@ -480,6 +511,8 @@
messageCounterHistoryDayLimit +
", pageSizeBytes=" +
pageSizeBytes +
+ ", pageMaxCache=" +
+ pageMaxCache +
", redeliveryDelay=" +
redeliveryDelay +
", redistributionDelay=" +
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/utils/SoftValueHashMap.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/utils/SoftValueHashMap.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/utils/SoftValueHashMap.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -17,19 +17,22 @@
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
/**
- * A SoftValueConcurrentHashMap
+ * A SoftValueHashMap
*
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*
*
*/
-public class SoftValueHashMap<K, V> implements Map<K, V>
+public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implements Map<K, V>
{
// The soft references that are already good.
// too bad there's no way to override the queue method on ReferenceQueue, so I wouldn't need this
@@ -37,16 +40,42 @@
private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<K, AggregatedSoftReference>();
+ private final AtomicLong nextId = new AtomicLong(0);
+
+ private int maxElements;
+
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
+ public static abstract interface ValueCache
+ {
+ public abstract boolean isLive();
+ }
+
// Constructors --------------------------------------------------
+ public SoftValueHashMap(final int maxElements)
+ {
+ this.maxElements = maxElements;
+ }
+
// Public --------------------------------------------------------
+
+ public void setMaxElements(final int maxElements)
+ {
+ this.maxElements = maxElements;
+ checkCacheSize();
+ }
+
+ public int getMaxEelements()
+ {
+ return this.maxElements;
+ }
+
/**
* @return
* @see java.util.Map#size()
@@ -109,6 +138,7 @@
AggregatedSoftReference value = mapDelegate.get(key);
if (value != null)
{
+ value.used();
return value.get();
}
else
@@ -127,6 +157,7 @@
{
processQueue();
AggregatedSoftReference refPut = mapDelegate.put(key, createReference(key, value));
+ checkCacheSize();
if (refPut != null)
{
return refPut.get();
@@ -137,6 +168,66 @@
}
}
+ private void checkCacheSize()
+ {
+ if (maxElements > 0 && mapDelegate.size() > maxElements)
+ {
+ TreeSet<AggregatedSoftReference> usedReferences = new TreeSet<AggregatedSoftReference>(new ComparatorAgregated());
+
+ for (AggregatedSoftReference ref : mapDelegate.values())
+ {
+ V v = ref.get();
+
+ if (v != null && !v.isLive())
+ {
+ usedReferences.add(ref);
+ }
+ }
+
+ for (AggregatedSoftReference ref : usedReferences)
+ {
+ mapDelegate.remove(ref.key);
+
+ if (mapDelegate.size() <= maxElements)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ class ComparatorAgregated implements Comparator<AggregatedSoftReference>
+ {
+ public int compare(AggregatedSoftReference o1, AggregatedSoftReference o2)
+ {
+ long k = o1.used - o2.used;
+
+ if (k > 0)
+ {
+ return 1;
+ }
+ else if (k < 0)
+ {
+ return -1;
+ }
+
+ k = o1.id - o2.id;
+
+ if (k > 0)
+ {
+ return 1;
+ }
+ else if (k < 0)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+
/**
* @param key
* @return
@@ -222,7 +313,7 @@
V value = pair.getValue().get();
if (value != null)
{
- set.add(new EntryElement<K,V>(pair.getKey(), value));
+ set.add(new EntryElement<K, V>(pair.getKey(), value));
}
}
return set;
@@ -262,6 +353,7 @@
AggregatedSoftReference ref = null;
while ((ref = (AggregatedSoftReference)this.refQueue.poll()) != null)
{
+ System.out.println("Removing " + ref.key);
mapDelegate.remove(ref.key);
}
}
@@ -278,6 +370,20 @@
{
final K key;
+ long id = nextId.incrementAndGet();
+
+ long used = 0;
+
+ public long getUsed()
+ {
+ return used;
+ }
+
+ public void used()
+ {
+ used++;
+ }
+
public AggregatedSoftReference(final K key, final V referent)
{
super(referent, refQueue);
Modified: branches/Branch_2_2_EAP/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- branches/Branch_2_2_EAP/tests/config/ConfigurationTest-full-config.xml 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/config/ConfigurationTest-full-config.xml 2011-02-03 22:17:34 UTC (rev 10176)
@@ -202,6 +202,7 @@
<redelivery-delay>1</redelivery-delay>
<max-size-bytes>81781728121878</max-size-bytes>
<page-size-bytes>81738173872337</page-size-bytes>
+ <page-max-cache-size>10</page-max-cache-size>
<message-counter-history-day-limit>4</message-counter-history-day-limit>
</address-setting>
<address-setting match="a2">
@@ -210,6 +211,7 @@
<redelivery-delay>5</redelivery-delay>
<max-size-bytes>932489234928324</max-size-bytes>
<page-size-bytes>7126716262626</page-size-bytes>
+ <page-max-cache-size>20</page-max-cache-size>
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingOrderTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingOrderTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingOrderTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -879,6 +879,7 @@
1024 * 1024,
1024 * 10,
5,
+ 5,
0,
false,
"PAGE");
@@ -945,6 +946,7 @@
100 * 1024,
10 * 1024,
5,
+ 5,
0,
false,
"PAGE");
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -480,6 +480,7 @@
int deliveryAttempts = 1;
long maxSizeBytes = 2;
int pageSizeBytes = 3;
+ int pageMaxCacheSize = 7;
long redeliveryDelay = 4;
long redistributionDelay = 5;
boolean sendToDLAOnNoRoute = true;
@@ -492,6 +493,7 @@
deliveryAttempts,
maxSizeBytes,
pageSizeBytes,
+ pageMaxCacheSize,
redeliveryDelay,
redistributionDelay,
sendToDLAOnNoRoute,
@@ -508,6 +510,7 @@
assertEquals(lastValueQueue, info.isLastValueQueue());
assertEquals(deliveryAttempts, info.getMaxDeliveryAttempts());
assertEquals(maxSizeBytes, info.getMaxSizeBytes());
+ assertEquals(pageMaxCacheSize, info.getPageCacheMaxSize());
assertEquals(pageSizeBytes, info.getPageSizeBytes());
assertEquals(redeliveryDelay, info.getRedeliveryDelay());
assertEquals(redistributionDelay, info.getRedistributionDelay());
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -512,6 +512,7 @@
@Parameter(desc = "the delivery attempts", name = "deliveryAttempts") int deliveryAttempts,
@Parameter(desc = "the max size in bytes", name = "maxSizeBytes") long maxSizeBytes,
@Parameter(desc = "the page size in bytes", name = "pageSizeBytes") int pageSizeBytes,
+ int pageMaxCacheSize,
@Parameter(desc = "the redelivery delay", name = "redeliveryDelay") long redeliveryDelay,
@Parameter(desc = "the redistribution delay", name = "redistributionDelay") long redistributionDelay,
@Parameter(desc = "do we send to the DLA when there is no where to route the message", name = "sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute,
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -90,7 +90,7 @@
public void testReadCache() throws Exception
{
- final int NUM_MESSAGES = 1000;
+ final int NUM_MESSAGES = 100;
int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
@@ -98,7 +98,8 @@
PageCursorProviderImpl cursorProvider = new PageCursorProviderImpl(lookupPageStore(ADDRESS),
server.getStorageManager(),
- server.getExecutorFactory());
+ server.getExecutorFactory(),
+ 5);
for (int i = 0; i < numberOfPages; i++)
{
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -260,6 +260,7 @@
assertEquals(1, conf.getAddressesSettings().get("a1").getRedeliveryDelay());
assertEquals(81781728121878l, conf.getAddressesSettings().get("a1").getMaxSizeBytes());
assertEquals(81738173872337l, conf.getAddressesSettings().get("a1").getPageSizeBytes());
+ assertEquals(10, conf.getAddressesSettings().get("a1").getPageCacheMaxSize());
assertEquals(4, conf.getAddressesSettings().get("a1").getMessageCounterHistoryDayLimit());
assertEquals("a2.1", conf.getAddressesSettings().get("a2").getDeadLetterAddress().toString());
@@ -267,6 +268,7 @@
assertEquals(5, conf.getAddressesSettings().get("a2").getRedeliveryDelay());
assertEquals(932489234928324l, conf.getAddressesSettings().get("a2").getMaxSizeBytes());
assertEquals(7126716262626l, conf.getAddressesSettings().get("a2").getPageSizeBytes());
+ assertEquals(20, conf.getAddressesSettings().get("a2").getPageCacheMaxSize());
assertEquals(8, conf.getAddressesSettings().get("a2").getMessageCounterHistoryDayLimit());
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/util/SoftValueMapTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/util/SoftValueMapTest.java 2011-02-03 11:35:45 UTC (rev 10175)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/util/SoftValueMapTest.java 2011-02-03 22:17:34 UTC (rev 10176)
@@ -40,27 +40,111 @@
{
forceGC();
long maxMemory = Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory();
-
+
// each buffer will be 1/10th of the maxMemory
int bufferSize = (int)(maxMemory / 100);
+
+ class Value implements SoftValueHashMap.ValueCache
+ {
+ byte[] payload;
+
+ Value(byte[] payload)
+ {
+ this.payload = payload;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.utils.SoftValueHashMap.ValueCache#isLive()
+ */
+ public boolean isLive()
+ {
+ return false;
+ }
+ }
+
+ SoftValueHashMap<Long, Value> softCache = new SoftValueHashMap<Long, Value>(100);
+
+ final int MAX_ELEMENTS = 1000;
+
+ for (long i = 0; i < MAX_ELEMENTS; i++)
+ {
+ softCache.put(i, new Value(new byte[bufferSize]));
+ }
+
+ assertTrue(softCache.size() < MAX_ELEMENTS);
- SoftValueHashMap<Long, byte[]> softCache = new SoftValueHashMap<Long, byte[]>();
+ System.out.println("SoftCache.size " + softCache.size());
+
+ System.out.println("Soft cache has " + softCache.size() + " elements");
+ }
+
+
+ public void testEvictionsLeastUsed()
+ {
+ forceGC();
+
+ class Value implements SoftValueHashMap.ValueCache
+ {
+ byte[] payload;
+
+ boolean live;
+
+ Value(byte[] payload)
+ {
+ this.payload = payload;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.utils.SoftValueHashMap.ValueCache#isLive()
+ */
+ public boolean isLive()
+ {
+ return live;
+ }
+
+ public void setLive(boolean live)
+ {
+ this.live = live;
+ }
+ }
+
+ SoftValueHashMap<Long, Value> softCache = new SoftValueHashMap<Long, Value>(200);
- final int MAX_ELEMENTS = 1000;
+ for (long i = 0 ; i < 100; i++)
+ {
+ Value v = new Value(new byte[1]);
+ v.setLive(true);
+ softCache.put(i, v);
+ }
- for (long i = 0 ; i < MAX_ELEMENTS; i++)
+ for (long i = 100; i < 200; i++)
{
- softCache.put(i, new byte[bufferSize]);
+ Value v = new Value(new byte[1]);
+ softCache.put(i, v);
}
+ assertNotNull(softCache.get(100l));
- assertTrue(softCache.size() < MAX_ELEMENTS);
+ softCache.put(300l, new Value(new byte[1]));
+ // these are live, so they shouldn't go
+
+ for (long i = 0; i < 100; i++)
+ {
+ assertNotNull(softCache.get(i));
+ }
+
+ // this was accessed, so it shouldn't go
+ assertNotNull(softCache.get(100l));
+
+ // this is the next one, so it should go
+ assertNull(softCache.get(101l));
+
+ System.out.println("SoftCache.size " + softCache.size());
+
System.out.println("Soft cache has " + softCache.size() + " elements");
}
-
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
13 years, 11 months
JBoss hornetq SVN: r10175 - branches/Branch_2_2_EAP/examples/javaee/xarecovery/server.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-03 06:35:45 -0500 (Thu, 03 Feb 2011)
New Revision: 10175
Modified:
branches/Branch_2_2_EAP/examples/javaee/xarecovery/server/jbossts-properties.xml
Log:
fixed recovery config for local hornetq and and added example commented out for remote
Modified: branches/Branch_2_2_EAP/examples/javaee/xarecovery/server/jbossts-properties.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/xarecovery/server/jbossts-properties.xml 2011-02-02 13:44:15 UTC (rev 10174)
+++ branches/Branch_2_2_EAP/examples/javaee/xarecovery/server/jbossts-properties.xml 2011-02-03 11:35:45 UTC (rev 10175)
@@ -241,6 +241,13 @@
-->
<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ1"
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/>
+
+ <!--
+ <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ2"
+ value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.netty.NettyConnectorFactory,guest,guest,host=localhost,port=5445"/>-->
+
+
+ <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
</properties>
<properties depends="arjuna,txoj,jta" name="recoverymanager">
<!--
13 years, 11 months
JBoss hornetq SVN: r10174 - in branches/HORNETQ-316/src/main/org/hornetq: api/core/client and 8 other directories.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-02-02 08:44:15 -0500 (Wed, 02 Feb 2011)
New Revision: 10174
Added:
branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java
Removed:
branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/DiscoveryGroupConstants.java
Modified:
branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConfiguration.java
branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java
branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java
branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/SimpleUDPServerLocatorImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/BridgeConfiguration.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/ClusterConnectionConfiguration.java
branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/HORNETQ-316/src/main/org/hornetq/ra/HornetQResourceAdapter.java
Log:
also made BroadcastGroup pluggable
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConfiguration.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConfiguration.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConfiguration.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -54,5 +54,4 @@
{
return this.name;
}
-
}
Copied: branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java (from rev 10150, branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/DiscoveryGroupConstants.java)
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java (rev 0)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+/**
+ * A DiscoveryGroupConstants
+ *
+ * @author "<a href=\"tm.igarashi(a)gmail.com\">Tomohisa Igarashi</a>"
+ *
+ */
+public class DiscoveryGroupConstants
+{
+ // for static discovery
+ public static final String STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME = "static-connector-ref-list";
+ public static final String STATIC_CONNECTORS_LIST_NAME = "static-connector-list";
+
+ // for simple UDP discovery
+ public static final String LOCAL_BIND_ADDRESS_NAME = "local-bind-address";
+ public static final String GROUP_ADDRESS_NAME = "group-address";
+ public static final String GROUP_PORT_NAME = "group-port";
+ public static final String INITIAL_WAIT_TIMEOUT_NAME = "initial-wait-timeout";
+ public static final String REFRESH_TIMEOUT_NAME = "refresh-timeout";
+}
Property changes on: branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -13,10 +13,10 @@
package org.hornetq.api.core.client;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy;
-import org.hornetq.core.client.impl.DiscoveryGroupConstants;
import org.hornetq.core.client.impl.StaticServerLocatorImpl;
import java.lang.reflect.Constructor;
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -565,8 +565,7 @@
@Parameter(name="useDuplicateDetection", desc="Use duplicate detection") boolean useDuplicateDetection,
@Parameter(name="confirmationWindowSize", desc="Confirmation window size") int confirmationWindowSize,
@Parameter(name="clientFailureCheckPeriod", desc="Period to check client failure") long clientFailureCheckPeriod,
- @Parameter(name="staticConnectorNames", desc="comma separated list of connector names or name of discovery group if 'useDiscoveryGroup' is set to true") String connectorNames,
- @Parameter(name="useDiscoveryGroup", desc="use discovery group")boolean useDiscoveryGroup,
+ @Parameter(name="discoveryGroupName", desc="name of discovery group") String connectorNames,
@Parameter(name="ha", desc="Is it using HA") boolean ha,
@Parameter(name="user", desc="User name") String user,
@Parameter(name="password", desc="User password") String password) throws Exception;
Deleted: branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/DiscoveryGroupConstants.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/DiscoveryGroupConstants.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/DiscoveryGroupConstants.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.client.impl;
-
-/**
- * A DiscoveryGroupConstants
- *
- * @author "<a href=\"tm.igarashi(a)gmail.com\">Tomohisa Igarashi</a>"
- *
- */
-public class DiscoveryGroupConstants
-{
- // for static discovery
- public static final String STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME = "static-connector-ref-list";
- public static final String STATIC_CONNECTORS_LIST_NAME = "static-connector-list";
-
- // for simple UDP discovery
- public static final String LOCAL_BIND_ADDRESS_NAME = "local-bind-address";
- public static final String GROUP_ADDRESS_NAME = "group-address";
- public static final String GROUP_PORT_NAME = "group-port";
- public static final String INITIAL_WAIT_TIMEOUT_NAME = "initial-wait-timeout";
- public static final String REFRESH_TIMEOUT_NAME = "refresh-timeout";
-}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/SimpleUDPServerLocatorImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/SimpleUDPServerLocatorImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/SimpleUDPServerLocatorImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -19,6 +19,7 @@
import java.util.concurrent.*;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -18,6 +18,7 @@
import java.util.concurrent.*;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/config/BridgeConfiguration.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/BridgeConfiguration.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/BridgeConfiguration.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -16,6 +16,8 @@
import java.io.Serializable;
import java.util.List;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+
/**
* A BridgeConfiguration
*
@@ -37,9 +39,7 @@
private String filterString;
- private List<String> staticConnectors;
-
- private String discoveryGroupName;
+ private DiscoveryGroupConfiguration discoveryGroupConfiguration;
private boolean ha;
@@ -72,7 +72,7 @@
final boolean useDuplicateDetection,
final int confirmationWindowSize,
final long clientFailureCheckPeriod,
- final List<String> staticConnectors,
+ final DiscoveryGroupConfiguration discoveryGroupConfiguration,
final boolean ha,
final String user,
final String password)
@@ -88,41 +88,7 @@
this.useDuplicateDetection = useDuplicateDetection;
this.confirmationWindowSize = confirmationWindowSize;
this.clientFailureCheckPeriod = clientFailureCheckPeriod;
- this.staticConnectors = staticConnectors;
- this.user = user;
- this.password = password;
- discoveryGroupName = null;
- }
-
- public BridgeConfiguration(final String name,
- final String queueName,
- final String forwardingAddress,
- final String filterString,
- final String transformerClassName,
- final long retryInterval,
- final double retryIntervalMultiplier,
- final int reconnectAttempts,
- final boolean useDuplicateDetection,
- final int confirmationWindowSize,
- final long clientFailureCheckPeriod,
- final String discoveryGroupName,
- final boolean ha,
- final String user,
- final String password)
- {
- this.name = name;
- this.queueName = queueName;
- this.forwardingAddress = forwardingAddress;
- this.filterString = filterString;
- this.transformerClassName = transformerClassName;
- this.retryInterval = retryInterval;
- this.retryIntervalMultiplier = retryIntervalMultiplier;
- this.reconnectAttempts = reconnectAttempts;
- this.useDuplicateDetection = useDuplicateDetection;
- this.confirmationWindowSize = confirmationWindowSize;
- this.clientFailureCheckPeriod = clientFailureCheckPeriod;
- this.staticConnectors = null;
- this.discoveryGroupName = discoveryGroupName;
+ this.discoveryGroupConfiguration = discoveryGroupConfiguration;
this.ha = ha;
this.user = user;
this.password = password;
@@ -153,15 +119,10 @@
return transformerClassName;
}
- public List<String> getStaticConnectors()
+ public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
{
- return staticConnectors;
+ return discoveryGroupConfiguration;
}
-
- public String getDiscoveryGroupName()
- {
- return discoveryGroupName;
- }
public boolean isHA()
{
@@ -231,19 +192,11 @@
}
/**
- * @param staticConnectors the staticConnectors to set
- */
- public void setStaticConnectors(final List<String> staticConnectors)
- {
- this.staticConnectors = staticConnectors;
- }
-
- /**
* @param discoveryGroupName the discoveryGroupName to set
*/
- public void setDiscoveryGroupName(final String discoveryGroupName)
+ public void setDiscoveryGroupConfiguration(final DiscoveryGroupConfiguration discoveryGroupConfiguration)
{
- this.discoveryGroupName = discoveryGroupName;
+ this.discoveryGroupConfiguration = discoveryGroupConfiguration;
}
/**
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -15,6 +15,7 @@
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
import org.hornetq.core.logging.Logger;
@@ -32,73 +33,38 @@
private static final Logger log = Logger.getLogger(BroadcastGroupConfiguration.class);
+ private String broadcastGroupClassName;
+
+ private Map<String,Object> params;
+
private String name;
- private String localBindAddress;
-
- private int localBindPort;
-
- private String groupAddress;
-
- private int groupPort;
-
- private long broadcastPeriod;
-
- private List<String> connectorInfos;
-
- public BroadcastGroupConfiguration(final String name,
- final String localBindAddress,
- final int localBindPort,
- final String groupAddress,
- final int groupPort,
- final long broadcastPeriod,
- final List<String> connectorInfos)
+ public BroadcastGroupConfiguration(final String clazz,
+ final Map<String,Object> params,
+ final String name)
{
super();
+ this.broadcastGroupClassName = clazz;
+ this.params = params;
this.name = name;
- this.localBindAddress = localBindAddress;
- this.localBindPort = localBindPort;
- this.groupAddress = groupAddress;
- this.groupPort = groupPort;
- this.broadcastPeriod = broadcastPeriod;
- this.connectorInfos = connectorInfos;
+
}
- public String getName()
+ public String getBroadcastGroupClassName()
{
- return name;
+ return this.broadcastGroupClassName;
}
- public String getLocalBindAddress()
+ public Map<String, Object> getParams()
{
- return localBindAddress;
+ return this.params;
}
- public int getLocalBindPort()
+ public String getName()
{
- return localBindPort;
+ return name;
}
- public String getGroupAddress()
- {
- return groupAddress;
- }
-
- public int getGroupPort()
- {
- return groupPort;
- }
-
- public long getBroadcastPeriod()
- {
- return broadcastPeriod;
- }
-
- public List<String> getConnectorInfos()
- {
- return connectorInfos;
- }
-
/**
* @param name the name to set
*/
@@ -106,53 +72,4 @@
{
this.name = name;
}
-
- /**
- * @param localBindAddress the localBindAddress to set
- */
- public void setLocalBindAddress(final String localBindAddress)
- {
- this.localBindAddress = localBindAddress;
- }
-
- /**
- * @param localBindPort the localBindPort to set
- */
- public void setLocalBindPort(final int localBindPort)
- {
- this.localBindPort = localBindPort;
- }
-
- /**
- * @param groupAddress the groupAddress to set
- */
- public void setGroupAddress(final String groupAddress)
- {
- this.groupAddress = groupAddress;
- }
-
- /**
- * @param groupPort the groupPort to set
- */
- public void setGroupPort(final int groupPort)
- {
- this.groupPort = groupPort;
- }
-
- /**
- * @param broadcastPeriod the broadcastPeriod to set
- */
- public void setBroadcastPeriod(final long broadcastPeriod)
- {
- this.broadcastPeriod = broadcastPeriod;
- }
-
- /**
- * @param connectorInfos the connectorInfos to set
- */
- public void setConnectorInfos(final List<String> connectorInfos)
- {
- this.connectorInfos = connectorInfos;
- }
-
}
Added: branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java (rev 0)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.config;
+
+/**
+ * A BroadcastGroupConstants
+ *
+ * @author "<a href=\"tm.igarashi(a)gmail.com\">Tomohisa Igarashi</a>"
+ *
+ *
+ */
+public class BroadcastGroupConstants
+{
+ // for simple UDP broadcast
+ public static final String LOCAL_BIND_ADDRESS_NAME = "local-bind-address";
+ public static final String LOCAL_BIND_PORT_NAME = "local-bind-port";
+ public static final String GROUP_ADDRESS_NAME = "group-address";
+ public static final String GROUP_PORT_NAME = "group-port";
+ public static final String BROADCAST_PERIOD_NAME = "broadcast-period";
+ public static final String CONNECTOR_REF_LIST_NAME = "connector-ref-list";
+ public static final String CONNECTOR_LIST_NAME = "connector-list";
+
+}
Property changes on: branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/config/ClusterConnectionConfiguration.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -14,8 +14,9 @@
package org.hornetq.core.config;
import java.io.Serializable;
-import java.util.List;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+
/**
* A ClusterConnectionConfiguration
*
@@ -41,12 +42,8 @@
private final boolean forwardWhenNoConsumers;
- private final List<String> staticConnectors;
-
- private final List<String> allowableConnectors;
+ private final DiscoveryGroupConfiguration discoveryGroupConfiguration;
- private final String discoveryGroupName;
-
private final int maxHops;
private final int confirmationWindowSize;
@@ -61,10 +58,8 @@
final boolean forwardWhenNoConsumers,
final int maxHops,
final int confirmationWindowSize,
- final List<String> staticConnectors,
- final String discoveryGroupName,
- final boolean allowableConnectionsOnly,
- final List<String> allowableConnectorNames)
+ final DiscoveryGroupConfiguration discoveryGroupConfiguration,
+ final boolean allowableConnectionsOnly)
{
this.name = name;
this.address = address;
@@ -72,11 +67,9 @@
this.retryInterval = retryInterval;
this.duplicateDetection = duplicateDetection;
this.forwardWhenNoConsumers = forwardWhenNoConsumers;
- this.discoveryGroupName = discoveryGroupName;
+ this.discoveryGroupConfiguration = discoveryGroupConfiguration;
this.maxHops = maxHops;
this.confirmationWindowSize = confirmationWindowSize;
- this.staticConnectors = staticConnectors;
- this.allowableConnectors = allowableConnectorNames;
this.allowableConnectionsOnly = allowableConnectionsOnly;
}
@@ -115,21 +108,11 @@
return confirmationWindowSize;
}
- public List<String> getStaticConnectors()
+ public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
{
- return staticConnectors;
+ return discoveryGroupConfiguration;
}
-
- public List<String> getAllowableConnectors()
- {
- return allowableConnectors;
- }
- public String getDiscoveryGroupName()
- {
- return discoveryGroupName;
- }
-
public long getRetryInterval()
{
return retryInterval;
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -25,11 +25,11 @@
import java.util.StringTokenizer;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.client.impl.DiscoveryGroupConstants;
import org.hornetq.core.config.*;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.config.impl.FileConfiguration;
@@ -894,46 +894,41 @@
{
String name = e.getAttribute("name");
- String localAddress = XMLConfigurationUtil.getString(e, "local-bind-address", null, Validators.NO_CHECK);
+ String clazz = XMLConfigurationUtil.getString(e, "broadcast-group-class", null, Validators.NOT_NULL_OR_EMPTY);
- int localBindPort = XMLConfigurationUtil.getInteger(e, "local-bind-port", -1, Validators.MINUS_ONE_OR_GT_ZERO);
+ Map<String, Object> params = new HashMap<String, Object>();
- String groupAddress = XMLConfigurationUtil.getString(e, "group-address", null, Validators.NOT_NULL_OR_EMPTY);
+ NodeList paramsNodes = e.getElementsByTagName("param");
- int groupPort = XMLConfigurationUtil.getInteger(e, "group-port", -1, Validators.GT_ZERO);
+ for (int i = 0; i < paramsNodes.getLength(); i++)
+ {
+ Node paramNode = paramsNodes.item(i);
- long broadcastPeriod = XMLConfigurationUtil.getLong(e,
- "broadcast-period",
- ConfigurationImpl.DEFAULT_BROADCAST_PERIOD,
- Validators.GT_ZERO);
+ NamedNodeMap attributes = paramNode.getAttributes();
- NodeList children = e.getChildNodes();
+ Node nkey = attributes.getNamedItem("key");
- List<String> connectorNames = new ArrayList<String>();
+ String key = nkey.getTextContent();
- for (int j = 0; j < children.getLength(); j++)
- {
- Node child = children.item(j);
+ Node nValue = attributes.getNamedItem("value");
- if (child.getNodeName().equals("connector-ref"))
- {
- String connectorName = XMLConfigurationUtil.getString(e,
- "connector-ref",
- null,
- Validators.NOT_NULL_OR_EMPTY);
+ params.put(key, nValue.getTextContent());
+ }
- connectorNames.add(connectorName);
+ String connectorList = (String)params.get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME);
+ if(connectorList != null)
+ {
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ StringTokenizer token = new StringTokenizer(connectorList, ",", false);
+ while(token.hasMoreElements())
+ {
+ connectors.add(mainConfig.getConnectorConfigurations().get(token.nextElement()));
}
+ params.put(BroadcastGroupConstants.CONNECTOR_LIST_NAME, connectors.toArray(new TransportConfiguration[0]));
}
+
+ BroadcastGroupConfiguration config = new BroadcastGroupConfiguration(clazz, params, name);
- BroadcastGroupConfiguration config = new BroadcastGroupConfiguration(name,
- localAddress,
- localBindPort,
- groupAddress,
- groupPort,
- broadcastPeriod,
- connectorNames);
-
mainConfig.getBroadcastGroupConfigurations().add(config);
}
@@ -962,7 +957,6 @@
params.put(key, nValue.getTextContent());
}
- // discovery-group configuration contains static connector list
String connectorList = (String)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME);
if(connectorList != null)
{
@@ -1043,34 +1037,8 @@
}
}
- List<String> staticConnectors = new ArrayList<String>();
- DiscoveryGroupConfiguration discovery = mainConfig.getDiscoveryGroupConfigurations().get(discoveryGroupName);
- Map<String,Object> params = discovery.getParams();
- String connectorList = (String)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME);
- if(connectorList != null)
- {
- StringTokenizer token = new StringTokenizer(connectorList, ",", false);
- while(token.hasMoreElements())
- {
- staticConnectors.add(token.nextToken());
- }
- }
+ DiscoveryGroupConfiguration discoveryGroupConfiguration = mainConfig.getDiscoveryGroupConfigurations().get(discoveryGroupName);
- List<String> allowableConnectionNames = null;
- if(allowDirectConnectionsOnly)
- {
- if(connectorList == null)
- {
- log.warn("allow-direct-connections-only was found, but "
- + DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME
- + " was not found in discovery-group. ignore.");
- }
- else
- {
- allowableConnectionNames = staticConnectors;
- }
- }
-
ClusterConnectionConfiguration config;
config = new ClusterConnectionConfiguration(name,
@@ -1081,10 +1049,8 @@
forwardWhenNoConsumers,
maxHops,
confirmationWindowSize,
- staticConnectors,
- discoveryGroupName,
- allowDirectConnectionsOnly,
- allowableConnectionNames);
+ discoveryGroupConfiguration,
+ allowDirectConnectionsOnly);
mainConfig.getClusterConfigurations().add(config);
}
@@ -1157,10 +1123,8 @@
String filterString = null;
- List<String> staticConnectorNames = new ArrayList<String>();
+ DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
- String discoveryGroupName = null;
-
NodeList children = brNode.getChildNodes();
for (int j = 0; j < children.getLength(); j++)
@@ -1173,70 +1137,32 @@
}
else if (child.getNodeName().equals("discovery-group-ref"))
{
- discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
+ String discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
+ discoveryGroupConfiguration = mainConfig.getDiscoveryGroupConfigurations().get(discoveryGroupName);
}
- else if (child.getNodeName().equals("static-connectors"))
- {
- getStaticConnectors(staticConnectorNames, child);
- }
}
BridgeConfiguration config;
- if (!staticConnectorNames.isEmpty())
- {
- config = new BridgeConfiguration(name,
- queueName,
- forwardingAddress,
- filterString,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- reconnectAttempts,
- useDuplicateDetection,
- confirmationWindowSize,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectorNames,
- ha,
- user,
- password);
- }
- else
- {
- config = new BridgeConfiguration(name,
- queueName,
- forwardingAddress,
- filterString,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- reconnectAttempts,
- useDuplicateDetection,
- confirmationWindowSize,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- discoveryGroupName,
- ha,
- user,
- password);
- }
+ config = new BridgeConfiguration(name,
+ queueName,
+ forwardingAddress,
+ filterString,
+ transformerClassName,
+ retryInterval,
+ retryIntervalMultiplier,
+ reconnectAttempts,
+ useDuplicateDetection,
+ confirmationWindowSize,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ discoveryGroupConfiguration,
+ ha,
+ user,
+ password);
mainConfig.getBridgeConfigurations().add(config);
}
- private void getStaticConnectors(List<String> staticConnectorNames, Node child)
- {
- NodeList children2 = ((Element)child).getElementsByTagName("connector-ref");
-
- for (int k = 0; k < children2.getLength(); k++)
- {
- Element child2 = (Element)children2.item(k);
-
- String connectorName = child2.getChildNodes().item(0).getNodeValue();
-
- staticConnectorNames.add(connectorName);
- }
- }
-
private void parseDivertConfiguration(final Element e, final Configuration mainConfig)
{
String name = e.getAttribute("name");
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -13,8 +13,12 @@
package org.hornetq.core.management.impl;
+import java.util.Map;
+
import javax.management.MBeanOperationInfo;
+import org.hornetq.api.core.DiscoveryGroupConstants;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.BridgeControl;
import org.hornetq.core.config.BridgeConfiguration;
import org.hornetq.core.persistence.StorageManager;
@@ -58,7 +62,19 @@
clearIO();
try
{
- return configuration.getStaticConnectors().toArray(new String[0]);
+ Map<String,Object> params = configuration.getDiscoveryGroupConfiguration().getParams();
+ TransportConfiguration[] staticConnectors = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ if(staticConnectors == null)
+ {
+ return null;
+ }
+
+ String[] staticConnectorNames = new String[staticConnectors.length];
+ for(int i=0; i<staticConnectors.length; i++)
+ {
+ staticConnectorNames[i] = staticConnectors[i].getName();
+ }
+ return staticConnectorNames;
}
finally
{
@@ -97,7 +113,7 @@
clearIO();
try
{
- return configuration.getDiscoveryGroupName();
+ return configuration.getDiscoveryGroupConfiguration().getName();
}
finally
{
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -13,10 +13,14 @@
package org.hornetq.core.management.impl;
+import java.util.Map;
+
import javax.management.MBeanOperationInfo;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.BroadcastGroupControl;
import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.server.cluster.BroadcastGroup;
import org.hornetq.utils.json.JSONArray;
@@ -72,7 +76,16 @@
clearIO();
try
{
- return configuration.getBroadcastPeriod();
+ Map<String,Object> params = configuration.getParams();
+ String period = (String)params.get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME);
+ if(period == null)
+ {
+ return -1;
+ }
+ else
+ {
+ return Long.parseLong(period);
+ }
}
finally
{
@@ -85,12 +98,15 @@
clearIO();
try
{
- Object[] ret = new Object[configuration.getConnectorInfos().size()];
+ Map<String,Object> params = configuration.getParams();
+ TransportConfiguration[] connectors = (TransportConfiguration[])params.get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
+
+ Object[] ret = new Object[connectors.length];
int i = 0;
- for (String connector : configuration.getConnectorInfos())
+ for (TransportConfiguration conn : connectors)
{
- ret[i++] = connector;
+ ret[i++] = conn.getName();
}
return ret;
@@ -108,9 +124,12 @@
{
JSONArray array = new JSONArray();
- for (String connector : configuration.getConnectorInfos())
+ Map<String,Object> params = configuration.getParams();
+ TransportConfiguration[] connectors = (TransportConfiguration[])params.get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
+
+ for (TransportConfiguration conn : connectors)
{
- array.put(connector);
+ array.put(conn.getName());
}
return array.toString();
}
@@ -125,7 +144,8 @@
clearIO();
try
{
- return configuration.getGroupAddress();
+ Map<String,Object> params = configuration.getParams();
+ return (String)params.get(BroadcastGroupConstants.GROUP_ADDRESS_NAME);
}
finally
{
@@ -138,7 +158,16 @@
clearIO();
try
{
- return configuration.getGroupPort();
+ Map<String,Object> params = configuration.getParams();
+ String port = (String)params.get(BroadcastGroupConstants.GROUP_PORT_NAME);
+ if(port == null)
+ {
+ return -1;
+ }
+ else
+ {
+ return Integer.parseInt(port);
+ }
}
finally
{
@@ -151,7 +180,16 @@
clearIO();
try
{
- return configuration.getLocalBindPort();
+ Map<String,Object> params = configuration.getParams();
+ String port = (String)params.get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME);
+ if(port == null)
+ {
+ return -1;
+ }
+ else
+ {
+ return Integer.parseInt(port);
+ }
}
finally
{
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -18,6 +18,8 @@
import javax.management.MBeanOperationInfo;
+import org.hornetq.api.core.DiscoveryGroupConstants;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.ClusterConnectionControl;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.persistence.StorageManager;
@@ -74,7 +76,7 @@
clearIO();
try
{
- return configuration.getDiscoveryGroupName();
+ return configuration.getDiscoveryGroupConfiguration().getName();
}
finally
{
@@ -143,14 +145,19 @@
clearIO();
try
{
- if (configuration.getStaticConnectors() == null)
+ Map<String,Object> params = configuration.getDiscoveryGroupConfiguration().getParams();
+ TransportConfiguration[] staticConnectors = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ if(staticConnectors == null)
{
return null;
}
- else
+
+ String[] staticConnectorNames = new String[staticConnectors.length];
+ for(int i=0; i<staticConnectors.length; i++)
{
- return configuration.getStaticConnectors().toArray(new String[0]);
+ staticConnectorNames[i] = staticConnectors[i].getName();
}
+ return staticConnectorNames;
}
finally
{
@@ -163,7 +170,7 @@
clearIO();
try
{
- List<String> connectors = configuration.getStaticConnectors();
+ String[] connectors = getStaticConnectors();
if (connectors == null)
{
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -1641,8 +1641,7 @@
final boolean useDuplicateDetection,
final int confirmationWindowSize,
final long clientFailureCheckPeriod,
- final String connectorNames,
- boolean useDiscoveryGroup,
+ final String discoveryGroupName,
final boolean ha,
final String user,
final String password) throws Exception
@@ -1655,43 +1654,22 @@
try
{
BridgeConfiguration config = null;
- if (useDiscoveryGroup)
- {
- config = new BridgeConfiguration(name,
- queueName,
- forwardingAddress,
- filterString,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- reconnectAttempts,
- useDuplicateDetection,
- confirmationWindowSize,
- clientFailureCheckPeriod,
- connectorNames,
- ha,
- user,
- password);
- }
- else
- {
- List<String> connectors = toList(connectorNames);
- config = new BridgeConfiguration(name,
- queueName,
- forwardingAddress,
- filterString,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- reconnectAttempts,
- useDuplicateDetection,
- confirmationWindowSize,
- clientFailureCheckPeriod,
- connectors,
- ha,
- user,
- password);
- }
+ config = new BridgeConfiguration(name,
+ queueName,
+ forwardingAddress,
+ filterString,
+ transformerClassName,
+ retryInterval,
+ retryIntervalMultiplier,
+ reconnectAttempts,
+ useDuplicateDetection,
+ confirmationWindowSize,
+ clientFailureCheckPeriod,
+ configuration.getDiscoveryGroupConfigurations().get(discoveryGroupName),
+ ha,
+ user,
+ password);
+
server.deployBridge(config);
}
finally
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -13,6 +13,8 @@
package org.hornetq.core.server.cluster;
+import java.util.concurrent.ScheduledExecutorService;
+
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.management.NotificationService;
@@ -42,4 +44,6 @@
void broadcastConnectors() throws Exception;
void activate();
+
+ void schedule(ScheduledExecutorService scheduler);
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -18,13 +18,18 @@
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.NotificationType;
+import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.cluster.BroadcastGroup;
import org.hornetq.core.server.management.Notification;
@@ -48,14 +53,8 @@
private final String name;
- private final InetAddress localAddress;
-
- private final int localPort;
-
- private final InetAddress groupAddress;
-
- private final int groupPort;
-
+ private final BroadcastGroupConfiguration broadcastGroupConfiguration;
+
private DatagramSocket socket;
private final List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
@@ -77,26 +76,17 @@
*/
public BroadcastGroupImpl(final String nodeID,
final String name,
- final InetAddress localAddress,
- final int localPort,
- final InetAddress groupAddress,
- final int groupPort,
- final boolean active) throws Exception
+ final boolean active,
+ final BroadcastGroupConfiguration config) throws Exception
{
this.nodeID = nodeID;
this.name = name;
- this.localAddress = localAddress;
-
- this.localPort = localPort;
-
- this.groupAddress = groupAddress;
-
- this.groupPort = groupPort;
-
this.active = active;
+ this.broadcastGroupConfiguration = config;
+
uniqueID = UUIDGenerator.getInstance().generateStringUUID();
}
@@ -112,6 +102,11 @@
return;
}
+ Map<String,Object> params = this.broadcastGroupConfiguration.getParams();
+ int localPort = Integer.parseInt((String)params.get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
+ String localAddr = (String)params.get(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME);
+ InetAddress localAddress = InetAddress.getByName(localAddr);
+
if (localPort != -1)
{
socket = new DatagramSocket(localPort, localAddress);
@@ -222,6 +217,11 @@
byte[] data = buff.toByteBuffer().array();
+ Map<String,Object> params = broadcastGroupConfiguration.getParams();
+ int groupPort = Integer.parseInt((String)params.get(BroadcastGroupConstants.GROUP_PORT_NAME));
+ String groupAddr = (String)params.get(BroadcastGroupConstants.GROUP_ADDRESS_NAME);
+ InetAddress groupAddress = InetAddress.getByName(groupAddr);
+
DatagramPacket packet = new DatagramPacket(data, data.length, groupAddress, groupPort);
socket.send(packet);
@@ -244,9 +244,13 @@
}
}
- public synchronized void setScheduledFuture(final ScheduledFuture<?> future)
+ public void schedule(ScheduledExecutorService scheduler)
{
- this.future = future;
+ Map<String,Object> params = broadcastGroupConfiguration.getParams();
+
+ this.future = scheduler.scheduleWithFixedDelay(this,
+ 0L,
+ Long.parseLong((String)params.get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME)),
+ TimeUnit.MILLISECONDS);
}
-
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -21,6 +21,7 @@
import java.util.concurrent.ScheduledExecutorService;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -128,8 +129,7 @@
final boolean backup,
final String clusterUser,
final String clusterPassword,
- final boolean allowableConnectionsOnly,
- final TransportConfiguration[] allowableConnections) throws Exception
+ final boolean allowableConnectionsOnly) throws Exception
{
if (nodeUUID == null)
@@ -306,6 +306,14 @@
props);
managementService.sendNotification(notification);
}
+
+ if(this.allowableConnectionsOnly)
+ {
+ Map<String,Object> params = discoveryGroupConfiguration.getParams();
+ TransportConfiguration[] sc = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ List<TransportConfiguration> staticConnectors = java.util.Arrays.asList(sc);
+ this.allowableConnections.addAll(staticConnectors);
+ }
}
public TransportConfiguration getConnector()
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -16,6 +16,7 @@
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
import java.net.InetAddress;
import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
@@ -23,6 +24,7 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -498,43 +500,23 @@
return;
}
- InetAddress localAddress = null;
- if (config.getLocalBindAddress() != null)
- {
- localAddress = InetAddress.getByName(config.getLocalBindAddress());
- }
+ String className = config.getBroadcastGroupClassName();
- InetAddress groupAddress = InetAddress.getByName(config.getGroupAddress());
-
- BroadcastGroupImpl group = new BroadcastGroupImpl(nodeUUID.toString(),
- config.getName(),
- localAddress,
- config.getLocalBindPort(),
- groupAddress,
- config.getGroupPort(),
- !backup);
-
- for (String connectorInfo : config.getConnectorInfos())
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<?> clazz = loader.loadClass(className);
+ Constructor<?> constructor = clazz.getConstructor(String.class, String.class, Boolean.class, DiscoveryGroupConfiguration.class);
+ BroadcastGroup group = (BroadcastGroup)constructor.newInstance(nodeUUID.toString(), config.getName(), !backup, config);
+
+ if (group.size() == 0)
{
- TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorInfo);
-
- if (connector == null)
- {
- logWarnNoConnector(config.getName(), connectorInfo);
-
- return;
- }
-
- group.addConnector(connector);
+ ClusterManagerImpl.log.warn("There is no connector deployed for the broadcast group with name '" +
+ group.getName() +
+ "'. That will not be deployed.");
+ return;
}
- ScheduledFuture<?> future = scheduledExecutor.scheduleWithFixedDelay(group,
- 0L,
- config.getBroadcastPeriod(),
- MILLISECONDS);
-
- group.setScheduledFuture(future);
-
+ group.schedule(scheduledExecutor);
+
broadcastGroups.put(config.getName(), group);
managementService.registerBroadcastGroup(group, config);
@@ -545,37 +527,6 @@
}
}
- private void logWarnNoConnector(final String connectorName, final String bgName)
- {
- ClusterManagerImpl.log.warn("There is no connector deployed with name '" + connectorName +
- "'. The broadcast group with name '" +
- bgName +
- "' will not be deployed.");
- }
-
- private TransportConfiguration[] connectorNameListToArray(final List<String> connectorNames)
- {
- TransportConfiguration[] tcConfigs = (TransportConfiguration[])Array.newInstance(TransportConfiguration.class,
- connectorNames.size());
- int count = 0;
- for (String connectorName : connectorNames)
- {
- TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
-
- if (connector == null)
- {
- ClusterManagerImpl.log.warn("No connector defined with name '" + connectorName +
- "'. The bridge will not be deployed.");
-
- return null;
- }
-
- tcConfigs[count++] = connector;
- }
-
- return tcConfigs;
- }
-
public synchronized void deployBridge(final BridgeConfiguration config) throws Exception
{
if (config.getName() == null)
@@ -621,16 +572,8 @@
ServerLocatorInternal serverLocator;
- DiscoveryGroupConfiguration discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations()
- .get(config.getDiscoveryGroupName());
- if (discoveryGroupConfiguration == null)
- {
- ClusterManagerImpl.log.warn("No discovery group configured with name '" + config.getDiscoveryGroupName() +
- "'. The bridge will not be deployed.");
+ DiscoveryGroupConfiguration discoveryGroupConfiguration = config.getDiscoveryGroupConfiguration();
- return;
- }
-
if (config.isHA())
{
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(discoveryGroupConfiguration);
@@ -717,20 +660,14 @@
ClusterConnectionImpl clusterConnection;
DiscoveryGroupConfiguration dg = configuration.getDiscoveryGroupConfigurations()
- .get(config.getDiscoveryGroupName());
+ .get(config.getDiscoveryGroupConfiguration().getName());
if (dg == null)
{
- ClusterManagerImpl.log.warn("No discovery group with name '" + config.getDiscoveryGroupName() +
+ ClusterManagerImpl.log.warn("No discovery group with name '" + config.getDiscoveryGroupConfiguration().getName() +
"'. The cluster connection will not be deployed.");
}
- List<String> connectorNames = config.getAllowableConnectors();
- TransportConfiguration[] allowableConnections = null;
- if(connectorNames != null)
- {
- allowableConnections = connectorNameListToArray(connectorNames);
- }
clusterConnection = new ClusterConnectionImpl(dg,
connector,
new SimpleString(config.getName()),
@@ -749,8 +686,7 @@
backup,
server.getConfiguration().getClusterUser(),
server.getConfiguration().getClusterPassword(),
- config.isAllowableConnectionsOnly(),
- allowableConnections);
+ config.isAllowableConnectionsOnly());
managementService.registerCluster(clusterConnection, config);
@@ -767,11 +703,11 @@
private void announceBackup(final ClusterConnectionConfiguration config, final TransportConfiguration connector) throws Exception
{
DiscoveryGroupConfiguration dg = configuration.getDiscoveryGroupConfigurations()
- .get(config.getDiscoveryGroupName());
+ .get(config.getDiscoveryGroupConfiguration().getName());
if (dg == null)
{
- ClusterManagerImpl.log.warn("No discovery group with name '" + config.getDiscoveryGroupName() +
+ ClusterManagerImpl.log.warn("No discovery group with name '" + config.getDiscoveryGroupConfiguration().getName() +
"'. The cluster connection will not be deployed.");
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-02-02 13:09:22 UTC (rev 10173)
+++ branches/HORNETQ-316/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-02-02 13:44:15 UTC (rev 10174)
@@ -30,6 +30,7 @@
import javax.transaction.xa.XAResource;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
@@ -37,7 +38,6 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
-import org.hornetq.core.client.impl.DiscoveryGroupConstants;
import org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
13 years, 11 months
JBoss hornetq SVN: r10173 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-02 08:09:22 -0500 (Wed, 02 Feb 2011)
New Revision: 10173
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
Tweak to fix test
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-02-02 08:35:03 UTC (rev 10172)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-02-02 13:09:22 UTC (rev 10173)
@@ -1020,7 +1020,10 @@
Queue queue = (Queue)binding.getBindable();
- queue.getPageSubscription().close();
+ if (queue.getPageSubscription() != null)
+ {
+ queue.getPageSubscription().close();
+ }
if (queue.getConsumerCount() != 0)
{
13 years, 11 months
JBoss hornetq SVN: r10172 - in branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing: server0 and 3 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-02 03:35:03 -0500 (Wed, 02 Feb 2011)
New Revision: 10172
Modified:
branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/readme.html
branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server0/hornetq-configuration.xml
branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server1/hornetq-configuration.xml
branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server2/hornetq-configuration.xml
branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/src/org/hornetq/jms/example/ClientSideLoadBalancingExample.java
Log:
https://issues.jboss.org/browse/JBPAPP-5782 - updated client side load balancing example
Modified: branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/readme.html
===================================================================
--- branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/readme.html 2011-02-02 05:25:08 UTC (rev 10171)
+++ branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/readme.html 2011-02-02 08:35:03 UTC (rev 10172)
@@ -8,7 +8,7 @@
<body onload="prettyPrint()">
<h1>JMS Client-Side Load-Balancing Example</h1>
- <p>This example demonstrates how sessions created from a single JMS Connection can be created
+ <p>This example demonstrates how connnections created from a single JMS Connection factory can be created
to different nodes of the cluster. In other words it demonstrates how HornetQ does <b>client side load balancing</b> of
connections across the cluster.</p>
<p>The particular load-balancing policy can be chosen to be random, round-robin or user-defined. Please see the user
@@ -44,20 +44,24 @@
<code>ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");</code>
</pre>
- <li>We create a single connection</li>
+ <li> We create 3 JMS connections from the same connection factory. Since we are using round-robin
+ load-balancing this should result in each sessions being connected to a different node of the cluster</li>
<pre class="prettyprint">
<code>
- connection = connectionFactory.createConnection();
+ Connection conn = connectionFactory.createConnection();
+ connectionA = connectionFactory.createConnection();
+ connectionB = connectionFactory.createConnection();
+ connectionC = connectionFactory.createConnection();
+ conn.close();
</code>
</pre>
- <li>We create 3 JMS Sessions from the same connection. Since we are using round-robin
- load-balancing this should result in each sessions being connected to a different node of the cluster</li>
+ <li>We create JMS Sessions</li>
<pre class="prettyprint">
<code>
- Session sessionA = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Session sessionB = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Session sessionC = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionB = connectionB.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionC = connectionC.createSession(false, Session.AUTO_ACKNOWLEDGE);
</code>
</pre>
@@ -95,7 +99,9 @@
<li>We start the connection to consume messages</li>
<pre class="prettyprint">
<code>
- connection.start();
+ connectionA.start();
+ connectionB.start();
+ connectionC.start();
</code>
</pre>
@@ -117,15 +123,23 @@
<code>
finally
{
- if (connection0 != null)
- {
- connection0.close();
- }
-
- if (connection1 != null)
- {
- connection1.close();
- }
+ if (connectionA != null)
+ {
+ connectionA.close();
+ }
+ if (connectionB != null)
+ {
+ connectionB.close();
+ }
+ if (connectionC != null)
+ {
+ connectionC.close();
+ }
+
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
}
</code>
</pre>
Modified: branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server0/hornetq-configuration.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server0/hornetq-configuration.xml 2011-02-02 05:25:08 UTC (rev 10171)
+++ branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server0/hornetq-configuration.xml 2011-02-02 08:35:03 UTC (rev 10172)
@@ -38,6 +38,15 @@
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <connector-ref>netty-connector</connector-ref>
+ <max-hops>0</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
<!-- Other config -->
Modified: branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server1/hornetq-configuration.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server1/hornetq-configuration.xml 2011-02-02 05:25:08 UTC (rev 10171)
+++ branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server1/hornetq-configuration.xml 2011-02-02 08:35:03 UTC (rev 10172)
@@ -5,7 +5,6 @@
<clustered>true</clustered>
<!-- Connectors -->
-
<connectors>
<connector name="netty-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
@@ -22,7 +21,6 @@
</acceptors>
<!-- Clustering configuration -->
-
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<group-address>231.7.7.7</group-address>
@@ -39,7 +37,16 @@
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
-
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <connector-ref>netty-connector</connector-ref>
+ <max-hops>0</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
<!-- Other config -->
<security-settings>
@@ -54,4 +61,4 @@
</security-setting>
</security-settings>
-</configuration>
\ No newline at end of file
+</configuration>
Modified: branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server2/hornetq-configuration.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server2/hornetq-configuration.xml 2011-02-02 05:25:08 UTC (rev 10171)
+++ branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/server2/hornetq-configuration.xml 2011-02-02 08:35:03 UTC (rev 10172)
@@ -38,6 +38,15 @@
</discovery-group>
</discovery-groups>
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <connector-ref>netty-connector</connector-ref>
+ <max-hops>0</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
<!-- Other config -->
<security-settings>
Modified: branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/src/org/hornetq/jms/example/ClientSideLoadBalancingExample.java
===================================================================
--- branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/src/org/hornetq/jms/example/ClientSideLoadBalancingExample.java 2011-02-02 05:25:08 UTC (rev 10171)
+++ branches/Branch_2_2_EAP/examples/jms/client-side-load-balancing/src/org/hornetq/jms/example/ClientSideLoadBalancingExample.java 2011-02-02 08:35:03 UTC (rev 10172)
@@ -45,7 +45,9 @@
{
InitialContext initialContext = null;
- Connection connection = null;
+ Connection connectionA = null;
+ Connection connectionB = null;
+ Connection connectionC = null;
try
{
@@ -61,15 +63,23 @@
// Wait a little while to make sure broadcasts from all nodes have reached the client
Thread.sleep(5000);
- // Step 4. We create a single connection
- connection = connectionFactory.createConnection();
-
- // Step 5. We create 3 JMS Sessions from the same connection. Since we are using round-robin
+ // Step 4. We create 3 JMS connections from the same connection factory. Since we are using round-robin
// load-balancing this should result in each sessions being connected to a different node of the cluster
- Session sessionA = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Session sessionB = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Session sessionC = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Connection conn = connectionFactory.createConnection();
+ connectionA = connectionFactory.createConnection();
+ connectionB = connectionFactory.createConnection();
+ connectionC = connectionFactory.createConnection();
+ conn.close();
+ // Step 5. We create JMS Sessions
+ Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionB = connectionB.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionC = connectionC.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ System.out.println("Session A - " + ((org.hornetq.core.client.impl.DelegatingSession) ((org.hornetq.jms.client.HornetQSession) sessionA).getCoreSession()).getConnection().getRemoteAddress() );
+ System.out.println("Session B - " + ((org.hornetq.core.client.impl.DelegatingSession) ((org.hornetq.jms.client.HornetQSession) sessionB).getCoreSession()).getConnection().getRemoteAddress() );
+ System.out.println("Session C - " + ((org.hornetq.core.client.impl.DelegatingSession) ((org.hornetq.jms.client.HornetQSession) sessionC).getCoreSession()).getConnection().getRemoteAddress() );
+
// Step 6. We create JMS MessageProducer objects on the sessions
MessageProducer producerA = sessionA.createProducer(queue);
MessageProducer producerB = sessionB.createProducer(queue);
@@ -94,7 +104,9 @@
}
// Step 8. We start the connection to consume messages
- connection.start();
+ connectionA.start();
+ connectionB.start();
+ connectionC.start();
// Step 9. We consume messages from the 3 session, one at a time.
// We try to consume one more message than expected from each session. If
@@ -110,10 +122,18 @@
{
// Step 10. Be sure to close our resources!
- if (connection != null)
+ if (connectionA != null)
{
- connection.close();
+ connectionA.close();
}
+ if (connectionB != null)
+ {
+ connectionB.close();
+ }
+ if (connectionC != null)
+ {
+ connectionC.close();
+ }
if (initialContext != null)
{
13 years, 11 months
JBoss hornetq SVN: r10171 - branches/Branch_2_2_EAP/hornetq-rest.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-02 00:25:08 -0500 (Wed, 02 Feb 2011)
New Revision: 10171
Modified:
branches/Branch_2_2_EAP/hornetq-rest/pom.xml
Log:
new build
Modified: branches/Branch_2_2_EAP/hornetq-rest/pom.xml
===================================================================
--- branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-02-02 05:24:52 UTC (rev 10170)
+++ branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-02-02 05:25:08 UTC (rev 10171)
@@ -10,7 +10,7 @@
<properties>
<resteasy.version>2.0.1.GA</resteasy.version>
- <hornetq.version>2.2.0.EAP-QA-10162</hornetq.version>
+ <hornetq.version>2.2.0.EAP-QA-10169</hornetq.version>
</properties>
<licenses>
13 years, 11 months
JBoss hornetq SVN: r10170 - branches/Branch_2_2_EAP.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-02 00:24:52 -0500 (Wed, 02 Feb 2011)
New Revision: 10170
Modified:
branches/Branch_2_2_EAP/build-maven.xml
Log:
new build
Modified: branches/Branch_2_2_EAP/build-maven.xml
===================================================================
--- branches/Branch_2_2_EAP/build-maven.xml 2011-02-02 03:36:20 UTC (rev 10169)
+++ branches/Branch_2_2_EAP/build-maven.xml 2011-02-02 05:24:52 UTC (rev 10170)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.2.0.EAP-QA-10162"/>
+ <property name="hornetq.version" value="2.2.0.EAP-QA-10169"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
13 years, 11 months