JBoss hornetq SVN: r8052 - trunk/src/main/org/hornetq/jms/bridge.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-10-06 05:35:13 -0400 (Tue, 06 Oct 2009)
New Revision: 8052
Removed:
trunk/src/main/org/hornetq/jms/bridge/BridgeMBean.java
trunk/src/main/org/hornetq/jms/bridge/BridgeService.java
Log:
HORNETQ-169: Remove BridgeService & BridgeMBean classes
* remove old JMX-style classes to setup a JMS Bridge now that it is a POJO
Deleted: trunk/src/main/org/hornetq/jms/bridge/BridgeMBean.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/BridgeMBean.java 2009-10-06 09:31:00 UTC (rev 8051)
+++ trunk/src/main/org/hornetq/jms/bridge/BridgeMBean.java 2009-10-06 09:35:13 UTC (rev 8052)
@@ -1,105 +0,0 @@
-/*
- * 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.
- */
-
-package org.hornetq.jms.bridge;
-
-import javax.management.ObjectName;
-
-
-/**
- * A BridgeMBean
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public interface BridgeMBean
-{
- // JMX attributes
-
- void setSourceProviderLoader(ObjectName sourceProviderLoader);
-
- ObjectName getSourceProviderLoader();
-
- void setTargetProviderLoader(ObjectName targetProviderLoader);
-
- ObjectName getTargetProviderLoader();
-
- String getSourceDestinationLookup();
-
- String getTargetDestinationLookup();
-
- void setSourceDestinationLookup(String lookup);
-
- void setTargetDestinationLookup(String lookup);
-
- String getSourceUsername();
-
- String getSourcePassword();
-
- void setSourceUsername(String name);
-
- void setSourcePassword(String pwd);
-
- String getTargetUsername();
-
- String getTargetPassword();
-
- void setTargetUsername(String name);
-
- void setTargetPassword(String pwd);
-
- int getQualityOfServiceMode();
-
- void setQualityOfServiceMode(int mode);
-
- String getSelector();
-
- void setSelector(String selector);
-
- int getMaxBatchSize();
-
- void setMaxBatchSize(int size);
-
- long getMaxBatchTime();
-
- void setMaxBatchTime(long time);
-
- String getSubName();
-
- void setSubName(String subname);
-
- String getClientID();
-
- void setClientID(String clientID);
-
- long getFailureRetryInterval();
-
- void setFailureRetryInterval(long interval);
-
- int getMaxRetries();
-
- void setMaxRetries(int retries);
-
- boolean isFailed();
-
- boolean isPaused();
-
- // JMX operations
-
- void pause() throws Exception;
-
- void resume() throws Exception;
-}
Deleted: trunk/src/main/org/hornetq/jms/bridge/BridgeService.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/BridgeService.java 2009-10-06 09:31:00 UTC (rev 8051)
+++ trunk/src/main/org/hornetq/jms/bridge/BridgeService.java 2009-10-06 09:35:13 UTC (rev 8052)
@@ -1,407 +0,0 @@
-/*
- * 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.
- */
-
-package org.hornetq.jms.bridge;
-
-import javax.management.ObjectName;
-
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.HornetQComponent;
-import org.hornetq.jms.bridge.impl.JMSBridgeImpl;
-
-/**
- * A BridgeService
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class BridgeService implements BridgeMBean
-{
- private static final Logger log = Logger.getLogger(BridgeService.class);
-
- private JMSBridge bridge;
-
- private String sourceDestinationLookup;
-
- private String targetDestinationLookup;
-
- private ObjectName sourceProviderLoader;
-
- private ObjectName targetProviderLoader;
-
-
- public BridgeService()
- {
- bridge = new JMSBridgeImpl();
- }
-
- // JMX attributes ----------------------------------------------------------------
-
- public synchronized ObjectName getSourceProviderLoader()
- {
- return sourceProviderLoader;
- }
-
- public synchronized void setSourceProviderLoader(ObjectName sourceProvider)
- {
- if (bridge.isStarted())
- {
- log.warn("Cannot set SourceProvider when bridge is started");
- return;
- }
- this.sourceProviderLoader = sourceProvider;
- }
-
- public synchronized ObjectName getTargetProviderLoader()
- {
- return targetProviderLoader;
- }
-
- public synchronized void setTargetProviderLoader(ObjectName targetProvider)
- {
- if (bridge.isStarted())
- {
- log.warn("Cannot set TargetProvider when bridge is started");
- return;
- }
- this.targetProviderLoader = targetProvider;
- }
-
- public String getSourceDestinationLookup()
- {
- return sourceDestinationLookup;
- }
-
- public String getTargetDestinationLookup()
- {
- return targetDestinationLookup;
- }
-
- public void setSourceDestinationLookup(String lookup)
- {
- if (bridge.isStarted())
- {
- log.warn("Cannot set SourceDestinationLookup when bridge is started");
- return;
- }
- this.sourceDestinationLookup = checkAndTrim(lookup);
- }
-
- public void setTargetDestinationLookup(String lookup)
- {
- if (bridge.isStarted())
- {
- log.warn("Cannot set TargetDestinationLookup when bridge is started");
- return;
- }
- this.targetDestinationLookup = checkAndTrim(lookup);
- }
-
- public String getSourceUsername()
- {
- return bridge.getSourceUsername();
- }
-
- public String getSourcePassword()
- {
- return bridge.getSourcePassword();
- }
-
- public void setSourceUsername(String name)
- {
- bridge.setSourceUsername(name);
- }
-
- public void setSourcePassword(String pwd)
- {
- bridge.setSourcePassword(pwd);
- }
-
- public String getTargetUsername()
- {
- return bridge.getTargetUsername();
- }
-
- public String getTargetPassword()
- {
- return bridge.getTargetPassword();
- }
-
- public void setTargetUsername(String name)
- {
- bridge.setTargetUsername(name);
- }
-
- public void setTargetPassword(String pwd)
- {
- bridge.setTargetPassword(pwd);
- }
-
- public int getQualityOfServiceMode()
- {
- return bridge.getQualityOfServiceMode().intValue();
- }
-
- public void setQualityOfServiceMode(int mode)
- {
- bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode));
- }
-
- public String getSelector()
- {
- return bridge.getSelector();
- }
-
- public void setSelector(String selector)
- {
- bridge.setSelector(selector);
- }
-
- public int getMaxBatchSize()
- {
- return bridge.getMaxBatchSize();
- }
-
- public void setMaxBatchSize(int size)
- {
- bridge.setMaxBatchSize(size);
- }
-
- public long getMaxBatchTime()
- {
- return bridge.getMaxBatchTime();
- }
-
- public void setMaxBatchTime(long time)
- {
- bridge.setMaxBatchTime(time);
- }
-
- public String getSubName()
- {
- return bridge.getSubscriptionName();
- }
-
- public void setSubName(String subname)
- {
- bridge.setSubscriptionName(subname);
- }
-
- public String getClientID()
- {
- return bridge.getClientID();
- }
-
- public void setClientID(String clientID)
- {
- bridge.setClientID(clientID);
- }
-
- public long getFailureRetryInterval()
- {
- return bridge.getFailureRetryInterval();
- }
-
- public void setFailureRetryInterval(long interval)
- {
- bridge.setFailureRetryInterval(interval);
- }
-
- public int getMaxRetries()
- {
- return bridge.getMaxRetries();
- }
-
- public void setMaxRetries(int retries)
- {
- bridge.setMaxRetries(retries);
- }
-
- public boolean isAddMessageIDInHeader()
- {
- return bridge.isAddMessageIDInHeader();
- }
-
- public void setAddMessageIDInHeader(boolean value)
- {
- bridge.setAddMessageIDInHeader(value);
- }
-
-
- public String getTransactionManagerLocatorClass()
- {
- return bridge.getTransactionManagerLocatorClass();
- }
-
- public void setTransactionManagerLocatorClass(String transactionManagerLocatorClass)
- {
- bridge.setTransactionManagerLocatorClass(transactionManagerLocatorClass);
- }
-
- public String getTransactionManagerLocatorMethod()
- {
- return bridge.getTransactionManagerLocatorMethod();
- }
-
- public void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod)
- {
- bridge.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod);
- }
-
- public boolean isFailed()
- {
- return bridge.isFailed();
- }
-
- public boolean isPaused()
- {
- return bridge.isPaused();
- }
-
- public boolean isStarted()
- {
- return bridge.isStarted();
- }
-
- public HornetQComponent getInstance()
- {
- return bridge;
- }
-
- // JMX operations ----------------------------------------------------------------
-
- public void pause() throws Exception
- {
- bridge.pause();
- }
-
- public void resume() throws Exception
- {
- bridge.resume();
- }
-
- // ServiceMBeanSupport overrides --------------------------------------------------
-
- protected void startService() throws Exception
- {
- if (log.isTraceEnabled()) { log.trace("Starting bridge"); }
-
- //super.startService();
-
- if (this.sourceProviderLoader == null)
- {
- throw new IllegalArgumentException("sourceProvider cannot be null");
- }
-
- if (this.targetProviderLoader == null)
- {
- throw new IllegalArgumentException("targetProvider cannot be null");
- }
-
- if (sourceDestinationLookup == null)
- {
- throw new IllegalArgumentException("Source destination lookup cannot be null");
- }
-
- if (targetDestinationLookup == null)
- {
- throw new IllegalArgumentException("Target destination lookup cannot be null");
- }
-
- boolean sameSourceAndTarget = sourceProviderLoader.equals(targetProviderLoader);
-
- // Properties sourceProps = (Properties)server.getAttribute(sourceProviderLoader, "Properties");
-
- // Properties targetProps = (Properties)server.getAttribute(targetProviderLoader, "Properties");
-
- /*
- // JBMESSAGING-1183: set the factory refs according to the destinations types
- Context icSource = new InitialContext(sourceProps);
- Context icTarget = new InitialContext(targetProps);
- Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
- Destination targetDest = (Destination)icTarget.lookup(targetDestinationLookup);
- String sourceFactoryRef = "QueueFactoryRef";
- if(sourceDest instanceof Topic)
- {
- sourceFactoryRef = "TopicFactoryRef";
- }
- String targetFactoryRef = "QueueFactoryRef";
- if(targetDest instanceof Topic)
- {
- targetFactoryRef = "TopicFactoryRef";
- }
-
- String sourceCFRef = (String)server.getAttribute(sourceProviderLoader, sourceFactoryRef);
-
- String targetCFRef = (String)server.getAttribute(targetProviderLoader, targetFactoryRef);
- */
-
- //ConnectionFactoryFactory sourceCff =
- // new JNDIConnectionFactoryFactory(sourceProps, sourceCFRef);
-
- /* ConnectionFactoryFactory destCff;
-
- if (sameSourceAndTarget)
- {
- destCff = sourceCff;
- }
- else
- {
- destCff= new JNDIConnectionFactoryFactory(targetProps, targetCFRef);
- }
-
- bridge.setSourceConnectionFactoryFactory(sourceCff);
-
- bridge.setDestConnectionFactoryFactory(destCff);
-
- DestinationFactory sourceDestinationFactory = new JNDIDestinationFactory(sourceProps, sourceDestinationLookup);
-
- DestinationFactory targetDestinationFactory = new JNDIDestinationFactory(targetProps, targetDestinationLookup);
-
- bridge.setSourceDestinationFactory(sourceDestinationFactory);
-
- bridge.setTargetDestinationFactory(targetDestinationFactory);
-
- bridge.start();
-
- log.info("Started bridge " + this.getName() + ". Source: " + sourceDestinationLookup + " Target: " + targetDestinationLookup);*/
- }
-
-
- protected void stopService() throws Exception
- {
- if (log.isTraceEnabled()) { log.trace("Stopping bridge"); }
-
- bridge.stop();
-
- //log.info("Stopped bridge " + this.getName());
- }
-
- // Private ---------------------------------------------------------------------------------
-
- private String checkAndTrim(String s)
- {
- if (s != null)
- {
- s = s.trim();
- if ("".equals(s))
- {
- s = null;
- }
- }
- return s;
- }
-}
16 years, 2 months
JBoss hornetq SVN: r8051 - in trunk: examples/common/config and 22 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-10-06 05:31:00 -0400 (Tue, 06 Oct 2009)
New Revision: 8051
Added:
trunk/src/main/org/hornetq/core/logging/LogDelegate.java
trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java
trunk/src/main/org/hornetq/core/logging/impl/
trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java
trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java
trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
trunk/tests/src/org/hornetq/tests/integration/logging/
trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java
trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java
Removed:
trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java
trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java
trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java
Modified:
trunk/build-hornetq.xml
trunk/examples/common/config/server.properties
trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java
trunk/examples/jms/client-kickoff/ant.properties
trunk/examples/jms/jmx/ant.properties
trunk/examples/jms/large-message/ant.properties
trunk/examples/jms/message-counters/ant.properties
trunk/examples/jms/paging/ant.properties
trunk/examples/jms/symmetric-cluster/ant.properties
trunk/examples/jms/xa-heuristic/ant.properties
trunk/src/bin/run.bat
trunk/src/bin/run.sh
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
trunk/src/main/org/hornetq/core/config/Configuration.java
trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
trunk/src/main/org/hornetq/core/logging/Logger.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/tests/config/ConfigurationTest-full-config.xml
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-167
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/build-hornetq.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -186,7 +186,6 @@
<path id="logging.compilation.classpath">
<path refid="log4j.log4j.classpath"/>
- <path refid="org.jboss.logging.classpath"/>
</path>
<path id="javadoc.classpath">
@@ -255,7 +254,6 @@
<path refid="org.jboss.logging.classpath"/>
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
- <path refid="apache.logging.classpath"/>
<path refid="log4j.log4j.classpath"/>
</path>
@@ -280,7 +278,6 @@
<path refid="org.jboss.naming.classpath"/>
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
- <path refid="apache.logging.classpath"/>
<path refid="log4j.log4j.classpath"/>
<pathelement location="${test.dir}/config"/>
<pathelement location="${src.config.dir}/common"/>
@@ -1120,8 +1117,6 @@
<jvmarg value="-Djava.library.path=native/bin"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/trunk/non-clustered/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-XX:+PrintClassHistogram"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-verbose:gc"/>
@@ -1176,8 +1171,6 @@
<jvmarg value="-Djava.library.path=native/bin"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/trunk/non-clustered/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
<!--<jvmarg value="-ea"/>-->
<sysproperty key="java.io.tmpdir" value="${java.io.tmpdir}"/>
@@ -1253,7 +1246,6 @@
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
- <jvmarg value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=native/bin"/>
<!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
@@ -1417,8 +1409,6 @@
<jvmarg value="-XX:+UseFastAccessorMethods"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Djava.util.logging.config.file=${src.config.trunk.clustered.dir}/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
<jvmarg value="-Dhornetq.remoting.netty.port=${hornetq.remoting.netty.port}"/>
<jvmarg value="-Djnp.port=${jnp.port}"/>
@@ -1443,8 +1433,6 @@
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
<jvmarg value="-Djava.util.logging.config.file=${src.config.standalone.non-clustered.dir}/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
<jvmarg value="-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"/>
<jvmarg value="-Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"/>
Modified: trunk/examples/common/config/server.properties
===================================================================
--- trunk/examples/common/config/server.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/common/config/server.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java
===================================================================
--- trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -30,8 +30,7 @@
killChecker.start();
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
- System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- System.setProperty("org.jboss.logging.Logger.pluginClass", "org.hornetq.integration.logging.HornetQLoggerPlugin");
+ System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
bootstrap = new HornetQBootstrapServer(args);
bootstrap.run();
System.out.println("STARTED::");
Modified: trunk/examples/jms/client-kickoff/ant.properties
===================================================================
--- trunk/examples/jms/client-kickoff/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/client-kickoff/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/jmx/ant.properties
===================================================================
--- trunk/examples/jms/jmx/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/jmx/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/large-message/ant.properties
===================================================================
--- trunk/examples/jms/large-message/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/large-message/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/message-counters/ant.properties
===================================================================
--- trunk/examples/jms/message-counters/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/message-counters/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/paging/ant.properties
===================================================================
--- trunk/examples/jms/paging/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/paging/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/symmetric-cluster/ant.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/symmetric-cluster/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx100M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx100M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/xa-heuristic/ant.properties
===================================================================
--- trunk/examples/jms/xa-heuristic/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/xa-heuristic/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/src/bin/run.bat
===================================================================
--- trunk/src/bin/run.bat 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/bin/run.bat 2009-10-06 09:31:00 UTC (rev 8051)
@@ -9,8 +9,8 @@
set CLASSPATH=%CONFIG_DIR%;%HORNETQ_HOME%\schemas\
REM you can use the following line if you want to run with different ports
REM set CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445"
-set JVM_ARGS=%CLUSTER_PROPS% -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=%CONFIG_DIR% -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=.
-REM export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
+set JVM_ARGS=%CLUSTER_PROPS% -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=%CONFIG_DIR% -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Djava.library.path=.
+REM export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
for /R ..\lib %%A in (*.jar) do (
SET CLASSPATH=!CLASSPATH!;%%A
)
Modified: trunk/src/bin/run.sh
===================================================================
--- trunk/src/bin/run.sh 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/bin/run.sh 2009-10-06 09:31:00 UTC (rev 8051)
@@ -10,8 +10,8 @@
export CLASSPATH=$CONFIG_DIR:$HORNETQ_HOME/schemas/
#you can use the following line if you want to run with different ports
#export CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445"
-export JVM_ARGS="$CLUSTER_PROPS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=."
-#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
+export JVM_ARGS="$CLUSTER_PROPS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Djava.library.path=."
+#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
for i in `ls $HORNETQ_HOME/lib/*.jar`; do
CLASSPATH=$i:$CLASSPATH
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 09:31:00 UTC (rev 8051)
@@ -35,6 +35,8 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-password" type="xsd:string">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0" name="log-delegate-factory-class-name" type="xsd:string">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="management-request-timeout" type="xsd:long">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="jmx-management-enabled" type="xsd:boolean">
Modified: trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -3,6 +3,8 @@
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<clustered>true</clustered>
+
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
Modified: trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -2,6 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
+
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
<journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -169,6 +169,10 @@
void setPersistIDCache(boolean persist);
+ String getLogDelegateFactoryClassName();
+
+ void setLogDelegateFactoryClassName(String className);
+
// Journal related attributes ------------------------------------------------------------
String getBindingsDirectory();
Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -29,6 +29,7 @@
import org.hornetq.core.config.cluster.DiscoveryGroupConfiguration;
import org.hornetq.core.config.cluster.DivertConfiguration;
import org.hornetq.core.config.cluster.QueueConfiguration;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
import org.hornetq.core.server.JournalType;
import org.hornetq.utils.SimpleString;
@@ -161,6 +162,8 @@
public static final int DEFAULT_MEMORY_WARNING_THRESHOLD = 25;
public static final long DEFAULT_MEMORY_MEASURE_INTERVAL = 3000; // in milliseconds
+
+ public static final String DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME = JULLogDelegateFactory.class.getCanonicalName();
// Attributes -----------------------------------------------------------------------------
@@ -199,6 +202,8 @@
protected int idCacheSize = DEFAULT_ID_CACHE_SIZE;
protected boolean persistIDCache = DEFAULT_PERSIST_ID_CACHE;
+
+ protected String logDelegateFactoryClassName = DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME;
protected List<String> interceptorClassNames = new ArrayList<String>();
@@ -1080,4 +1085,14 @@
{
this.memoryMeasureInterval = memoryMeasureInterval;
}
+
+ public String getLogDelegateFactoryClassName()
+ {
+ return logDelegateFactoryClassName;
+ }
+
+ public void setLogDelegateFactoryClassName(String className)
+ {
+ this.logDelegateFactoryClassName = className;
+ }
}
Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -152,6 +152,8 @@
managementClusterUser = getString(e, "management-cluster-user", managementClusterUser, NOT_NULL_OR_EMPTY);
managementRequestTimeout = getLong(e, "management-request-timeout", managementRequestTimeout, GT_ZERO);
+
+ logDelegateFactoryClassName = getString(e, "log-delegate-factory-class-name", logDelegateFactoryClassName, NOT_NULL_OR_EMPTY);
NodeList interceptorNodes = e.getElementsByTagName("remoting-interceptors");
Added: trunk/src/main/org/hornetq/core/logging/LogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/LogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/LogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.core.logging;
+
+/**
+ * I represent operations that are delegated to underlying logging frameworks.
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegate
+{
+ boolean isInfoEnabled();
+
+ boolean isDebugEnabled();
+
+ boolean isTraceEnabled();
+
+ void fatal(Object message);
+
+ void fatal(Object message, Throwable t);
+
+ void error(Object message);
+
+ void error(Object message, Throwable t);
+
+ void warn(Object message);
+
+ void warn(Object message, Throwable t);
+
+ void info(Object message);
+
+ void info(Object message, Throwable t);
+
+ void debug(Object message);
+
+ void debug(Object message, Throwable t);
+
+ void trace(Object message);
+
+ void trace(Object message, Throwable t);
+}
\ No newline at end of file
Added: trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.core.logging;
+
+/**
+ * I am responsible for creating {@link LogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegateFactory
+{
+ LogDelegate createDelegate(Class<?> clazz);
+}
Modified: trunk/src/main/org/hornetq/core/logging/Logger.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -9,20 +9,19 @@
* 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.logging;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.logging.Level;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
+
/**
*
* A Logger
*
- * For now just delegates to org.jboss.util.Logger
- *
* This class allows us to isolate all our logging dependencies in one place
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
@@ -30,108 +29,173 @@
*/
public class Logger
{
+ public static final String LOGGER_DELEGATE_FACTORY_CLASS_NAME = "org.hornetq.logger-delegate-factory-class-name";
+
+ private static LogDelegateFactory delegateFactory;
+
private static final ConcurrentMap<Class<?>, Logger> loggers = new ConcurrentHashMap<Class<?>, Logger>();
+
+ static
+ {
+ initialise();
+ }
+
+ public static void setDelegateFactory(final LogDelegateFactory delegateFactory)
+ {
+ clear();
+
+ Logger.delegateFactory = delegateFactory;
+ }
+ private static void clear()
+ {
+ loggers.clear();
+ }
+
+ public static void reset()
+ {
+ clear();
+
+ initialise();
+ }
+
+ public static void initialise()
+ {
+ LogDelegateFactory delegateFactory;
+
+ // If a system property is specified then this overrides any delegate factory which is set
+ // programmatically - this is primarily of use so we can configure the logger delegate on the client side
+ String className = System.getProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME);
+
+ if (className != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class<?> clz = loader.loadClass(className);
+ delegateFactory = (LogDelegateFactory)clz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
+ }
+ }
+ else
+ {
+ delegateFactory = new JULLogDelegateFactory();
+ }
+
+ Logger.delegateFactory = delegateFactory;
+
+ loggers.clear();
+ }
+
public static Logger getLogger(final Class<?> clazz)
{
Logger logger = loggers.get(clazz);
-
+
if (logger == null)
{
- logger = new Logger(clazz);
-
+ LogDelegate delegate = delegateFactory.createDelegate(clazz);
+
+ logger = new Logger(delegate);
+
Logger oldLogger = loggers.putIfAbsent(clazz, logger);
-
+
if (oldLogger != null)
{
logger = oldLogger;
}
- }
-
+ }
+
return logger;
}
+
+ private final LogDelegate delegate;
+
+ Logger(final LogDelegate delegate)
+ {
+ this.delegate = delegate;
+ }
- private final java.util.logging.Logger logger;
-
- private Logger(final Class<?> clazz)
+ public LogDelegate getDelegate()
{
- logger = java.util.logging.Logger.getLogger(clazz.getName());
- //logger.setUseParentHandlers(false);
+ return delegate;
}
-
+
public boolean isInfoEnabled()
{
- return logger.isLoggable(Level.INFO);
+ return delegate.isInfoEnabled();
}
-
+
public boolean isDebugEnabled()
{
- return logger.isLoggable(Level.FINE);
+ return delegate.isDebugEnabled();
}
-
+
public boolean isTraceEnabled()
{
- return logger.isLoggable(Level.FINEST);
+ return delegate.isTraceEnabled();
}
-
+
public void fatal(final Object message)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ delegate.fatal(message);
}
-
+
public void fatal(final Object message, final Throwable t)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ delegate.fatal(message, t);
}
-
+
public void error(final Object message)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ delegate.error(message);
}
-
+
public void error(final Object message, final Throwable t)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ delegate.error(message, t);
}
-
+
public void warn(final Object message)
{
- logger.log(Level.WARNING, message==null?"NULL":message.toString());
+ delegate.warn(message);
}
-
+
public void warn(final Object message, final Throwable t)
{
- logger.log(Level.WARNING, message==null?"NULL":message.toString(), t);
+ delegate.warn(message, t);
}
-
+
public void info(final Object message)
{
- logger.log(Level.INFO, message==null?"NULL":message.toString());
+ delegate.info(message);
}
-
+
public void info(final Object message, final Throwable t)
{
- logger.log(Level.INFO, message==null?"NULL":message.toString(), t);
+ delegate.info(message, t);
}
-
+
public void debug(final Object message)
{
- logger.log(Level.FINE, message==null?"NULL":message.toString());
+ delegate.debug(message);
}
-
+
public void debug(final Object message, final Throwable t)
{
- logger.log(Level.FINE, message==null?"NULL":message.toString(), t);
+ delegate.debug(message, t);
}
-
+
public void trace(final Object message)
{
- logger.log(Level.FINEST, message==null?"NULL":message.toString());
+ delegate.trace(message);
}
-
+
public void trace(final Object message, final Throwable t)
{
- logger.log(Level.FINEST, message==null?"NULL":message.toString(), t);
+ delegate.trace(message, t);
}
-
+
}
Added: trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import java.util.logging.Level;
+
+import org.hornetq.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to java.util.logging
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class JULLogDelegate implements LogDelegate
+{
+ private final java.util.logging.Logger logger;
+
+ JULLogDelegate(final Class<?> clazz)
+ {
+ logger = java.util.logging.Logger.getLogger(clazz.getName());
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isLoggable(Level.FINE);
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isLoggable(Level.FINEST);
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.log(Level.WARNING, message==null?"NULL":message.toString());
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.log(Level.WARNING, message==null?"NULL":message.toString(), t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.log(Level.INFO, message==null?"NULL":message.toString());
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.log(Level.INFO, message==null?"NULL":message.toString(), t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.log(Level.FINE, message==null?"NULL":message.toString());
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.log(Level.FINEST, message==null?"NULL":message.toString());
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINEST, message==null?"NULL":message.toString(), t);
+ }
+
+}
Added: trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link JULLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class JULLogDelegateFactory implements LogDelegateFactory
+{
+ public LogDelegate createDelegate(final Class<?> clazz)
+ {
+ return new JULLogDelegate(clazz);
+ }
+}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -47,6 +47,7 @@
import org.hornetq.core.exception.HornetQException;
import org.hornetq.core.filter.Filter;
import org.hornetq.core.filter.impl.FilterImpl;
+import org.hornetq.core.logging.LogDelegateFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.management.ManagementService;
import org.hornetq.core.management.impl.HornetQServerControlImpl;
@@ -253,6 +254,8 @@
public synchronized void start() throws Exception
{
+ initialiseLogging();
+
log.info((configuration.isBackup() ? "backup" : "live") + " server is starting..");
if (started)
@@ -410,6 +413,8 @@
nodeID = null;
log.info("HornetQ Server version " + getVersion().getFullVersion() + " stopped");
+
+ Logger.reset();
}
// HornetQServer implementation
@@ -881,7 +886,7 @@
{
return threadPool;
}
-
+
/**
* This method is protected as it may be used as a hook for creating a custom storage manager (on tests for instance)
* @return
@@ -898,8 +903,6 @@
}
}
-
-
// Private
// --------------------------------------------------------------------------------------
@@ -966,11 +969,20 @@
scheduledPool,
managementConnectorID);
- memoryManager = new MemoryManagerImpl(configuration.getMemoryWarningThreshold(), configuration.getMemoryMeasureInterval());
+ memoryManager = new MemoryManagerImpl(configuration.getMemoryWarningThreshold(),
+ configuration.getMemoryMeasureInterval());
memoryManager.start();
}
+ private void initialiseLogging()
+ {
+ LogDelegateFactory logDelegateFactory =
+ (LogDelegateFactory)instantiateInstance(configuration.getLogDelegateFactoryClassName());
+
+ Logger.setDelegateFactory(logDelegateFactory);
+ }
+
private void initialisePart2() throws Exception
{
// Create the hard-wired components
@@ -1169,7 +1181,7 @@
queues.put(queueBindingInfo.getPersistenceID(), queue);
postOffice.addBinding(binding);
-
+
managementService.registerAddress(queueBindingInfo.getAddress());
managementService.registerQueue(queue, queueBindingInfo.getAddress(), storageManager);
}
@@ -1265,7 +1277,7 @@
}
postOffice.addBinding(binding);
-
+
managementService.registerAddress(address);
managementService.registerQueue(queue, address, storageManager);
@@ -1341,21 +1353,28 @@
if (transformerClassName != null)
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class<?> clz = loader.loadClass(transformerClassName);
- transformer = (Transformer)clz.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Error instantiating transformer class \"" + transformerClassName + "\"",
- e);
- }
+ transformer = (Transformer)instantiateInstance(transformerClassName);
}
+
return transformer;
}
+ private Object instantiateInstance(final String className)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class<?> clz = loader.loadClass(className);
+ Object object = clz.newInstance();
+
+ return object;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
+ }
+ }
+
// Inner classes
// --------------------------------------------------------------------------------
}
Deleted: trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.hornetq.integration.logging;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-/**
- * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
- */
-public abstract class BaseLoggerHandler extends Handler
-{
- public static final int SEVERE = 1000;
-
- public static final int WARNING = 900;
-
- public static final int INFO = 800;
-
- public static final int CONFIG = 700;
-
- public static final int FINE = 500;
-
- public static final int FINER = 400;
-
- public static final int FINEST = 300;
-
- public void publish(LogRecord record)
- {
- String loggerName = record.getLoggerName();
- Level level = record.getLevel();
- String message = record.getMessage();
- Throwable throwable = record.getThrown();
- publish(loggerName, level, message, throwable);
- }
-
- abstract void publish(String loggerName, Level level, String message, Throwable throwable);
-
- public void flush()
- {
- }
-
- public void close() throws SecurityException
- {
- }
-}
Deleted: trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-
-package org.hornetq.integration.logging;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.logging.LoggerPlugin;
-
-/**
- * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
- */
-@SuppressWarnings("deprecation")
-public class HornetQLoggerPlugin implements LoggerPlugin
-{
- Logger logger;
-
- public void init(String s)
- {
- logger = Logger.getLogger(s);
- }
-
- public boolean isTraceEnabled()
- {
- return logger.isLoggable(Level.FINEST);
- }
-
- public void trace(Object o)
- {
- logger.log(Level.FINEST, o.toString());
- }
-
- public void trace(Object o, Throwable throwable)
- {
- logger.log(Level.FINEST, o.toString(), throwable);
- }
-
- public void trace(String s, Object o, Throwable throwable)
- {
- logger.log(Level.FINEST, s + o, throwable);
- }
-
- public boolean isDebugEnabled()
- {
- return logger.isLoggable(Level.FINE);
- }
-
- public void debug(Object o)
- {
- logger.log(Level.FINE, o.toString());
- }
-
- public void debug(Object o, Throwable throwable)
- {
- logger.log(Level.FINE, o.toString(), throwable);
- }
-
- public void debug(String s, Object o, Throwable throwable)
- {
- logger.log(Level.FINE, s + o, throwable);
- }
-
- public boolean isInfoEnabled()
- {
- return logger.isLoggable(Level.INFO);
- }
-
- public void info(Object o)
- {
- logger.log(Level.INFO, o.toString());
- }
-
- public void info(Object o, Throwable throwable)
- {
- logger.log(Level.INFO, o.toString(), throwable);
- }
-
- public void info(String s, Object o, Throwable throwable)
- {
- logger.log(Level.INFO, s + o, throwable);
- }
-
- public void warn(Object o)
- {
- logger.log(Level.WARNING, o.toString());
- }
-
- public void warn(Object o, Throwable throwable)
- {
- logger.log(Level.WARNING, o.toString(), throwable);
- }
-
- public void warn(String s, Object o, Throwable throwable)
- {
- logger.log(Level.WARNING, s + o, throwable);
- }
-
- public void error(Object o)
- {
- logger.log(Level.SEVERE, o.toString());
- }
-
- public void error(Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, o.toString(), throwable);
- }
-
- public void error(String s, Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, s + o, throwable);
- }
-
- public void fatal(Object o)
- {
- logger.log(Level.SEVERE, o.toString());
- }
-
- public void fatal(Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, o.toString(), throwable);
- }
-
- public void fatal(String s, Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, s + o, throwable);
- }
-}
Added: trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to Apache Log4j
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class Log4jLogDelegate implements LogDelegate
+{
+ private final org.apache.log4j.Logger logger;
+
+ Log4jLogDelegate(final Class<?> clazz)
+ {
+ logger = org.apache.log4j.Logger.getLogger(clazz);
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isInfoEnabled();
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isDebugEnabled();
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isTraceEnabled();
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.fatal(message);
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.fatal(message, t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.error(message);
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.error(message, t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.warn(message);
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.warn(message, t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.info(message);
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.info(message, t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.debug(message);
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.debug(message, t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.trace(message);
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.trace(message, t);
+ }
+
+}
Added: trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link Log4jLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod(a)kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class Log4jLogDelegateFactory implements LogDelegateFactory
+{
+ /* (non-Javadoc)
+ * @see org.hornetq.core.logging.LogDelegateFactory#getLogDelegate(java.lang.Class)
+ */
+ public LogDelegate createDelegate(Class<?> clazz)
+ {
+ return new Log4jLogDelegate(clazz);
+ }
+
+}
Deleted: trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-package org.hornetq.integration.logging;
-
-import java.util.logging.Level;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
- */
-public class Log4jLoggerHandler extends BaseLoggerHandler
-{
- void publish(String loggerName, Level level, String message, Throwable throwable)
- {
- if (throwable == null)
- {
- switch (level.intValue())
- {
- case SEVERE:
- {
- Logger.getLogger(loggerName).error(message);
- break;
- }
- case WARNING:
- {
- Logger.getLogger(loggerName).warn(message);
- break;
- }
- case INFO:
- {
- Logger.getLogger(loggerName).info(message);
- break;
- }
- case CONFIG:
- {
- Logger.getLogger(loggerName).info(message);
- break;
- }
- case FINE:
- {
- Logger.getLogger(loggerName).debug(message);
- break;
- }
- case FINER:
- {
- Logger.getLogger(loggerName).debug(message);
- break;
- }
- case FINEST:
- {
- Logger.getLogger(loggerName).trace(message);
- break;
- }
- }
- }
- else
- {
- switch (level.intValue())
- {
- case SEVERE:
- {
- Logger.getLogger(loggerName).error(message, throwable);
- break;
- }
- case WARNING:
- {
- Logger.getLogger(loggerName).warn(message, throwable);
- break;
- }
- case INFO:
- {
- Logger.getLogger(loggerName).info(message, throwable);
- break;
- }
- case CONFIG:
- {
- Logger.getLogger(loggerName).info(message, throwable);
- break;
- }
- case FINE:
- {
- Logger.getLogger(loggerName).debug(message, throwable);
- break;
- }
- case FINER:
- {
- Logger.getLogger(loggerName).debug(message, throwable);
- break;
- }
- case FINEST:
- {
- Logger.getLogger(loggerName).trace(message, throwable);
- break;
- }
- }
- }
- }
-
- public void flush()
- {
- //no op
- }
-
- public void close() throws SecurityException
- {
- //no op
- }
-}
-
Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -16,6 +16,7 @@
<management-cluster-user>Frog</management-cluster-user>
<management-cluster-password>Wombat</management-cluster-password>
<jmx-management-enabled>false</jmx-management-enabled>
+ <log-delegate-factory-class-name>ocelot</log-delegate-factory-class-name>
<message-counter-enabled>true</message-counter-enabled>
<message-counter-max-day-history>5</message-counter-max-day-history>
<message-counter-sample-period>123456</message-counter-sample-period>
Added: trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.tests.integration.logging;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.logging.impl.JULLogDelegate;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.integration.logging.Log4jLogDelegate;
+import org.hornetq.integration.logging.Log4jLogDelegateFactory;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A LogDelegateTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class LogDelegateTest extends ServiceTestBase
+{
+ public void testConfigureJULViaConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = JULLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+
+ server.stop();
+ }
+
+ public void testConfigureLog4jViaConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = Log4jLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof Log4jLogDelegate);
+
+ server.stop();
+ }
+
+ public void testConfigureLog4jViaSystemProperty() throws Exception
+ {
+ System.setProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME, Log4jLogDelegateFactory.class.getCanonicalName());
+
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof Log4jLogDelegate);
+ }
+
+ public void testConfigureJULViaSystemProperty() throws Exception
+ {
+ System.setProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME, JULLogDelegateFactory.class.getCanonicalName());
+
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+ }
+
+ public void testDefault() throws Exception
+ {
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+ }
+
+ public void testDefaultWithConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+
+ server.stop();
+ }
+
+ public void testUserDefinedLogger() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = MyLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof MyLogDelegateFactory.MyLogDelegate);
+
+ server.stop();
+ }
+
+
+
+
+}
Added: trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.tests.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+/**
+ * A MyLogDelegateFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class MyLogDelegateFactory implements LogDelegateFactory
+{
+ public LogDelegate createDelegate(Class<?> clazz)
+ {
+ return new MyLogDelegate();
+ }
+
+ public class MyLogDelegate implements LogDelegate
+ {
+ public void debug(Object message, Throwable t)
+ {
+ }
+
+ public void debug(Object message)
+ {
+ }
+
+ public void error(Object message, Throwable t)
+ {
+ }
+
+ public void error(Object message)
+ {
+ }
+
+ public void fatal(Object message, Throwable t)
+ {
+ }
+
+ public void fatal(Object message)
+ {
+ }
+
+ public void info(Object message, Throwable t)
+ {
+ }
+
+ public void info(Object message)
+ {
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return false;
+ }
+
+ public void trace(Object message, Throwable t)
+ {
+ }
+
+ public void trace(Object message)
+ {
+ }
+
+ public void warn(Object message, Throwable t)
+ {
+ }
+
+ public void warn(Object message)
+ {
+ }
+
+ }
+}
+
+
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -49,6 +49,7 @@
assertEquals(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, conf.getScheduledThreadPoolMaxSize());
assertEquals(ConfigurationImpl.DEFAULT_SECURITY_INVALIDATION_INTERVAL, conf.getSecurityInvalidationInterval());
assertEquals(ConfigurationImpl.DEFAULT_SECURITY_ENABLED, conf.isSecurityEnabled());
+ assertEquals(ConfigurationImpl.DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME, conf.getLogDelegateFactoryClassName());
assertEquals(ConfigurationImpl.DEFAULT_BINDINGS_DIRECTORY, conf.getBindingsDirectory());
assertEquals(ConfigurationImpl.DEFAULT_CREATE_BINDINGS_DIR, conf.isCreateBindingsDir());
assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_DIR, conf.getJournalDirectory());
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -56,6 +56,7 @@
assertEquals(98765, conf.getTransactionTimeout());
assertEquals(56789, conf.getTransactionTimeoutScanPeriod());
assertEquals(10111213, conf.getMessageExpiryScanPeriod());
+ assertEquals("ocelot", conf.getLogDelegateFactoryClassName());
assertEquals(8, conf.getMessageExpiryThreadPriority());
assertEquals(127, conf.getIDCacheSize());
assertEquals(true, conf.isPersistIDCache());
16 years, 2 months
JBoss hornetq SVN: r8050 - in trunk: src/main/org/hornetq/core/management/impl and 3 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-10-06 05:06:28 -0400 (Tue, 06 Oct 2009)
New Revision: 8050
Added:
trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
Modified:
trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java
trunk/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
trunk/src/main/org/hornetq/core/server/cluster/MessageFlowRecord.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlUsingCoreTest.java
Log:
HORNETQ-168: Provide MBean for cluster diagnostics
* added to ClusterConnectionControl the management operation getNodes() which returns a Map of Node ID / addresses of the other
nodes for the given cluster
Modified: trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -13,8 +13,10 @@
package org.hornetq.core.management;
+import java.util.Map;
+
/**
* A ClusterConnectionControlMBean
*
@@ -26,6 +28,8 @@
String getName();
String getAddress();
+
+ String getNodeID();
boolean isDuplicateDetection();
@@ -40,4 +44,6 @@
String getDiscoveryGroupName();
long getRetryInterval();
+
+ Map<String, String> getNodes() throws Exception;
}
Modified: trunk/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -14,6 +14,7 @@
package org.hornetq.core.management.impl;
import java.util.List;
+import java.util.Map;
import javax.management.StandardMBean;
@@ -78,6 +79,11 @@
{
return configuration.getRetryInterval();
}
+
+ public String getNodeID()
+ {
+ return clusterConnection.getNodeID();
+ }
public Object[] getStaticConnectorNamePairs()
{
@@ -135,6 +141,11 @@
return configuration.isForwardWhenNoConsumers();
}
+ public Map<String, String> getNodes() throws Exception
+ {
+ return clusterConnection.getNodes();
+ }
+
public boolean isStarted()
{
return clusterConnection.isStarted();
Modified: trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -15,6 +15,7 @@
package org.hornetq.core.server.cluster;
import org.hornetq.core.management.NotificationService;
+import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.Consumer;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
@@ -48,4 +49,6 @@
void setQueue(Queue queue);
void setNotificationService(NotificationService notificationService);
+
+ RemotingConnection getForwardingConnection();
}
Modified: trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -13,6 +13,8 @@
package org.hornetq.core.server.cluster;
+import java.util.Map;
+
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.SimpleString;
@@ -29,6 +31,13 @@
{
SimpleString getName();
+ String getNodeID();
+
+ /**
+ * @return a Map of node ID and addresses
+ */
+ Map<String, String> getNodes();
+
void handleReplicatedAddBinding(SimpleString address,
SimpleString uniqueName,
SimpleString routingName,
Modified: trunk/src/main/org/hornetq/core/server/cluster/MessageFlowRecord.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/MessageFlowRecord.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/server/cluster/MessageFlowRecord.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -15,7 +15,6 @@
package org.hornetq.core.server.cluster;
import org.hornetq.core.client.MessageHandler;
-import org.hornetq.core.server.Queue;
/**
* A MessageFlowRecord
@@ -32,9 +31,8 @@
int getMaxHops();
- void activate(Queue queue) throws Exception;
-
- //void reset() throws Exception;
-
+ Bridge getBridge();
+
void close() throws Exception;
+
}
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -22,6 +22,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.concurrent.ScheduledExecutorService;
import org.hornetq.core.client.ClientMessage;
@@ -254,7 +255,25 @@
{
return name;
}
+
+ public String getNodeID()
+ {
+ return nodeUUID.toString();
+ }
+ public Map<String, String> getNodes()
+ {
+ Map<String, String> nodes = new HashMap<String, String>();
+ for (Entry<String, MessageFlowRecord> record : records.entrySet( ))
+ {
+ if (record.getValue().getBridge().getForwardingConnection() != null)
+ {
+ nodes.put(record.getKey(), record.getValue().getBridge().getForwardingConnection().getRemoteAddress());
+ }
+ }
+ return nodes;
+ }
+
public synchronized void activate()
{
if (!started)
@@ -442,19 +461,15 @@
clearBindings();
}
- public void activate(final Queue queue) throws Exception
- {
- this.queue = queue;
-
- bridge.setQueue(queue);
-
- bridge.start();
- }
-
public void setBridge(final Bridge bridge)
{
this.bridge = bridge;
}
+
+ public Bridge getBridge()
+ {
+ return bridge;
+ }
public synchronized void onMessage(final ClientMessage message)
{
Added: trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -0,0 +1,192 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.tests.integration.management;
+
+import static org.hornetq.tests.util.RandomUtil.randomBoolean;
+import static org.hornetq.tests.util.RandomUtil.randomPositiveInt;
+import static org.hornetq.tests.util.RandomUtil.randomPositiveLong;
+import static org.hornetq.tests.util.RandomUtil.randomString;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.config.cluster.BroadcastGroupConfiguration;
+import org.hornetq.core.config.cluster.ClusterConnectionConfiguration;
+import org.hornetq.core.config.cluster.DiscoveryGroupConfiguration;
+import org.hornetq.core.config.cluster.QueueConfiguration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.management.ClusterConnectionControl;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.server.HornetQ;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
+import org.hornetq.integration.transports.netty.NettyConnectorFactory;
+import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.utils.Pair;
+import org.hornetq.utils.json.JSONArray;
+import org.hornetq.utils.json.JSONObject;
+
+/**
+ * A BridgeControlTest
+ *
+ * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dec. 2008 17:38:58
+ *
+ */
+public class ClusterConnectionControl2Test extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private HornetQServer server_0;
+
+ private HornetQServer server_1;
+
+ private MBeanServer mbeanServer_1;
+
+ private int port_1 = TransportConstants.DEFAULT_PORT + 1000;
+
+ private ClusterConnectionConfiguration clusterConnectionConfig_0;
+
+ private String clusterName = "cluster";
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testNodes() throws Exception
+ {
+ ClusterConnectionControl clusterConnectionControl_0 = createManagementControl(clusterConnectionConfig_0.getName());
+ assertTrue(clusterConnectionControl_0.isStarted());
+ Map<String, String> nodes = clusterConnectionControl_0.getNodes();
+ assertEquals(0, nodes.size());
+
+ server_1.start();
+ Thread.sleep(3000);
+
+ nodes = clusterConnectionControl_0.getNodes();
+ System.out.println(nodes);
+ assertEquals(1, nodes.size());
+ String remoteAddress = nodes.values().iterator().next();
+ assertTrue(remoteAddress.endsWith(":" + port_1));
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ String discoveryName = randomString();
+ String groupAddress = "231.7.7.7";
+ int groupPort = 9876;
+
+ Map<String, Object> acceptorParams_1 = new HashMap<String, Object>();
+ acceptorParams_1.put(TransportConstants.PORT_PROP_NAME, port_1);
+ TransportConfiguration acceptorConfig_1 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), acceptorParams_1);
+
+ TransportConfiguration connectorConfig_1 = new TransportConfiguration(NettyConnectorFactory.class.getName(),
+ acceptorParams_1);
+
+ TransportConfiguration connectorConfig_0 = new TransportConfiguration(NettyConnectorFactory.class.getName());
+
+ QueueConfiguration queueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+
+ clusterConnectionConfig_0 = new ClusterConnectionConfiguration(clusterName,
+ queueConfig.getAddress(),
+ randomPositiveLong(),
+ randomBoolean(),
+ randomBoolean(),
+ randomPositiveInt(),
+ discoveryName);
+ List<Pair<String, String>> connectorInfos = new ArrayList<Pair<String, String>>();
+ connectorInfos.add(new Pair<String, String>("netty", null));
+ BroadcastGroupConfiguration broadcastGroupConfig = new BroadcastGroupConfiguration(discoveryName,
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ 250,
+ connectorInfos);
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(discoveryName,
+ groupAddress,
+ groupPort,
+ ClientSessionFactoryImpl.DEFAULT_DISCOVERY_REFRESH_TIMEOUT);
+
+ Configuration conf_1 = new ConfigurationImpl();
+ conf_1.setSecurityEnabled(false);
+ conf_1.setJMXManagementEnabled(true);
+ conf_1.setClustered(true);
+ conf_1.getAcceptorConfigurations().add(acceptorConfig_1);
+ conf_1.getConnectorConfigurations().put("netty", connectorConfig_1);
+ conf_1.getQueueConfigurations().add(queueConfig);
+ conf_1.getDiscoveryGroupConfigurations().put(discoveryName, discoveryGroupConfig);
+ conf_1.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
+
+ Configuration conf_0 = new ConfigurationImpl();
+ conf_0.setSecurityEnabled(false);
+ conf_0.setJMXManagementEnabled(true);
+ conf_0.setClustered(true);
+ conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ conf_0.getConnectorConfigurations().put("netty", connectorConfig_0);
+ conf_0.getClusterConfigurations().add(clusterConnectionConfig_0);
+ conf_0.getDiscoveryGroupConfigurations().put(discoveryName, discoveryGroupConfig);
+ conf_0.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
+
+ mbeanServer_1 = MBeanServerFactory.createMBeanServer();
+ server_1 = HornetQ.newHornetQServer(conf_1, mbeanServer_1, false);
+
+ server_0 = HornetQ.newHornetQServer(conf_0, mbeanServer, false);
+ server_0.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ server_0.stop();
+ server_1.stop();
+
+ server_0 = null;
+ server_1 = null;
+
+ MBeanServerFactory.releaseMBeanServer(mbeanServer_1);
+ mbeanServer_1 = null;
+
+ super.tearDown();
+ }
+
+ protected ClusterConnectionControl createManagementControl(String name) throws Exception
+ {
+ return ManagementControlHelper.createClusterConnectionControl(name, mbeanServer);
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
+import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import org.hornetq.core.config.Configuration;
@@ -64,6 +65,8 @@
private HornetQServer server_1;
+ private MBeanServer mbeanServer_1;
+
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@@ -198,7 +201,8 @@
conf_0.getClusterConfigurations().add(clusterConnectionConfig1);
conf_0.getClusterConfigurations().add(clusterConnectionConfig2);
- server_1 = HornetQ.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false);
+ mbeanServer_1 = MBeanServerFactory.createMBeanServer();
+ server_1 = HornetQ.newHornetQServer(conf_1, mbeanServer_1, false);
server_1.start();
server_0 = HornetQ.newHornetQServer(conf_0, mbeanServer, false);
@@ -215,6 +219,9 @@
server_1 = null;
+ MBeanServerFactory.releaseMBeanServer(mbeanServer_1);
+ mbeanServer_1 = null;
+
super.tearDown();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlUsingCoreTest.java 2009-10-06 08:25:32 UTC (rev 8049)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlUsingCoreTest.java 2009-10-06 09:06:28 UTC (rev 8050)
@@ -13,6 +13,8 @@
package org.hornetq.tests.integration.management;
+import java.util.Map;
+
import org.hornetq.core.client.ClientSession;
import org.hornetq.core.client.ClientSessionFactory;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
@@ -84,6 +86,11 @@
{
return (String)proxy.retrieveAttributeValue("staticConnectorNamePairsAsJSON");
}
+
+ public Map<String, String> getNodes() throws Exception
+ {
+ return (Map<String, String>)proxy.retrieveAttributeValue("nodes");
+ }
public boolean isDuplicateDetection()
{
@@ -99,6 +106,11 @@
{
return (String)proxy.retrieveAttributeValue("name");
}
+
+ public String getNodeID()
+ {
+ return (String)proxy.retrieveAttributeValue("nodeID");
+ }
public boolean isStarted()
{
16 years, 2 months
JBoss hornetq SVN: r8049 - trunk/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-10-06 04:25:32 -0400 (Tue, 06 Oct 2009)
New Revision: 8049
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
Log:
fixed test
Modified: trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2009-10-05 23:35:09 UTC (rev 8048)
+++ trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2009-10-06 08:25:32 UTC (rev 8049)
@@ -187,16 +187,8 @@
rc1.fail(new HornetQException(HornetQException.NOT_CONNECTED, "blah"));
- try
- {
- Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
- fail("Should throw exception");
- }
- catch (JMSException e)
- {
- //Ok
- }
-
+ Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
conn1.close();
}
}
16 years, 2 months
JBoss hornetq SVN: r8048 - branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-05 19:35:09 -0400 (Mon, 05 Oct 2009)
New Revision: 8048
Added:
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedFailoverTest.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedNettyAsynchronousFailoverTest.java
Modified:
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
Log:
Adding replicated tests
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2009-10-05 23:02:37 UTC (rev 8047)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2009-10-05 23:35:09 UTC (rev 8048)
@@ -56,6 +56,19 @@
{
super.setUp();
+ createConfigs();
+
+ server1Service.start();
+ server0Service.start();
+
+ }
+
+
+ /**
+ * @throws Exception
+ */
+ protected void createConfigs() throws Exception
+ {
Configuration config1 = super.createDefaultConfig();
config1.getAcceptorConfigurations().clear();
config1.getAcceptorConfigurations()
@@ -63,7 +76,7 @@
config1.setSecurityEnabled(false);
config1.setSharedStore(true);
config1.setBackup(true);
- server1Service = super.createServer(true, config1);
+ server1Service = createServer(true, config1);
Configuration config0 = super.createDefaultConfig();
config0.getAcceptorConfigurations().clear();
@@ -71,10 +84,8 @@
.add(getAcceptorTransportConfiguration(true));
config0.setSecurityEnabled(false);
config0.setSharedStore(true);
- server0Service = super.createServer(true, config0);
+ server0Service = createServer(true, config0);
- server1Service.start();
- server0Service.start();
}
Added: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedFailoverTest.java (rev 0)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedFailoverTest.java 2009-10-05 23:35:09 UTC (rev 8048)
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.tests.integration.cluster.failover;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A ReplicatedFailoverTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicatedFailoverTest extends FailoverTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void createConfigs() throws Exception
+ {
+ Configuration config1 = super.createDefaultConfig();
+ config1.setBindingsDirectory(config1.getBindingsDirectory() + "_backup");
+ config1.setJournalDirectory(config1.getJournalDirectory() + "_backup");
+ config1.getAcceptorConfigurations().clear();
+ config1.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
+ config1.setSecurityEnabled(false);
+ config1.setSharedStore(false);
+ config1.setBackup(true);
+ server1Service = super.createServer(true, config1);
+
+ Configuration config0 = super.createDefaultConfig();
+ config0.getAcceptorConfigurations().clear();
+ config0.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
+
+ config0.getConnectorConfigurations().put("toBackup", getConnectorTransportConfiguration(false));
+ config0.setBackupConnectorName("toBackup");
+ config0.setSecurityEnabled(false);
+ config0.setSharedStore(false);
+ server0Service = super.createServer(true, config0);
+
+ server1Service.start();
+ server0Service.start();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedNettyAsynchronousFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedNettyAsynchronousFailoverTest.java (rev 0)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedNettyAsynchronousFailoverTest.java 2009-10-05 23:35:09 UTC (rev 8048)
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.hornetq.tests.integration.cluster.failover;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A ReplicatedNettyAsynchronousFailoverTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicatedNettyAsynchronousFailoverTest extends NettyAsynchronousFailoverTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void createConfigs() throws Exception
+ {
+ Configuration config1 = super.createDefaultConfig();
+ config1.setBindingsDirectory(config1.getBindingsDirectory() + "_backup");
+ config1.setJournalDirectory(config1.getJournalDirectory() + "_backup");
+ config1.getAcceptorConfigurations().clear();
+ config1.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
+ config1.setSecurityEnabled(false);
+ config1.setSharedStore(false);
+ config1.setBackup(true);
+ server1Service = super.createServer(true, config1);
+
+ Configuration config0 = super.createDefaultConfig();
+ config0.getAcceptorConfigurations().clear();
+ config0.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
+
+ config0.getConnectorConfigurations().put("toBackup", getConnectorTransportConfiguration(false));
+ config0.setBackupConnectorName("toBackup");
+ config0.setSecurityEnabled(false);
+ config0.setSharedStore(false);
+ server0Service = super.createServer(true, config0);
+
+ server1Service.start();
+ server0Service.start();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
16 years, 2 months
JBoss hornetq SVN: r8047 - branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-05 19:02:37 -0400 (Mon, 05 Oct 2009)
New Revision: 8047
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
Log:
local fix on the branch
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-05 21:25:14 UTC (rev 8046)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-05 23:02:37 UTC (rev 8047)
@@ -126,7 +126,7 @@
storage.start();
this.bindingsJournal = storage.getBindingsJournal();
- this.messagingJournal = storage.getBindingsJournal();
+ this.messagingJournal = storage.getMessageJournal();
// We only need to load internal structures on the backup...
storage.loadInternalOnly();
16 years, 2 months
JBoss hornetq SVN: r8046 - branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-05 17:25:14 -0400 (Mon, 05 Oct 2009)
New Revision: 8046
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
Log:
local fix on the branch
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-10-05 19:18:07 UTC (rev 8045)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-10-05 21:25:14 UTC (rev 8046)
@@ -264,11 +264,11 @@
{
storageManager.afterReplicated(execAfterCommit);
}
+ else
+ {
+ execAfterCommit.run();
+ }
}
- else if (execAfterCommit != null)
- {
- execAfterCommit.run();
- }
}
else if (execAfterCommit != null)
{
16 years, 2 months
JBoss hornetq SVN: r8045 - in branches/Replication_Clebert: src/main/org/hornetq/core/persistence/impl/journal and 4 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-05 15:18:07 -0400 (Mon, 05 Oct 2009)
New Revision: 8045
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java
branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Changes
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -48,6 +48,8 @@
void afterReplicated(Runnable run);
+ void completeReplication();
+
UUID getPersistentID();
void setPersistentID(UUID id) throws Exception;
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -254,7 +254,7 @@
}
else
{
- this.messageJournal = localBindings;
+ this.messageJournal = localMessage;
}
@@ -265,6 +265,17 @@
perfBlastPages = config.getJournalPerfBlastPages();
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#completeReplication()
+ */
+ public void completeReplication()
+ {
+ if (replicator != null)
+ {
+ replicator.completeToken();
+ }
+ }
+
public boolean isReplicated()
{
return replicator != null;
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -261,4 +261,11 @@
return false;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#completeReplication()
+ */
+ public void completeReplication()
+ {
+ }
+
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -144,18 +144,38 @@
tx.commit();
- count++;
-
- if (count == batchSize)
+
+ Runnable action = new Runnable()
{
- // We continue the next batch on a different thread, so as not to keep the delivery thread busy for a very
- // long time in the case there are many messages in the queue
- active = false;
-
- executor.execute(new Prompter());
-
- count = 0;
+ public void run()
+ {
+
+ count++;
+
+ if (count == batchSize)
+ {
+ // We continue the next batch on a different thread, so as not to keep the delivery thread busy for a very
+ // long time in the case there are many messages in the queue
+ active = false;
+
+
+ executor.execute(new Prompter());
+
+ count = 0;
+ }
+
+ }
+ };
+
+ if (storageManager.isReplicated())
+ {
+ storageManager.afterReplicated(action);
+ storageManager.completeReplication();
}
+ else
+ {
+ action.run();
+ }
}
private class Prompter implements Runnable
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -755,35 +755,6 @@
return nodeID;
}
- public void handleReplicateRedistribution(final SimpleString queueName, final long messageID) throws Exception
- {
- Binding binding = postOffice.getBinding(queueName);
-
- if (binding == null)
- {
- throw new IllegalStateException("Cannot find queue " + queueName);
- }
-
- Queue queue = (Queue)binding.getBindable();
-
- MessageReference reference = queue.removeFirstReference(messageID);
-
- Transaction tx = new TransactionImpl(storageManager);
-
- boolean routed = postOffice.redistribute(reference.getMessage(), queue, tx);
-
- if (routed)
- {
- queue.acknowledge(tx, reference);
-
- tx.commit();
- }
- else
- {
- throw new IllegalStateException("Must be routed");
- }
- }
-
public Queue createQueue(final SimpleString address,
final SimpleString queueName,
final SimpleString filterString,
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -420,9 +420,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleCreateQueue(final CreateQueueMessage packet)
@@ -495,9 +493,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleDeleteQueue(final SessionDeleteQueueMessage packet)
@@ -533,9 +529,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleExecuteQueueQuery(final SessionQueueQueryMessage packet)
@@ -590,9 +584,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleExecuteBindingQuery(final SessionBindingQueryMessage packet)
@@ -636,9 +628,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleAcknowledge(final SessionAcknowledgeMessage packet)
@@ -673,12 +663,7 @@
}
}
- channel.confirm(packet);
-
- if (response != null)
- {
- channel.send(response);
- }
+ sendResponse(packet, response, false, false);
}
public void handleExpired(final SessionExpiredMessage packet)
@@ -697,7 +682,8 @@
log.error("Failed to acknowledge", e);
}
- channel.confirm(packet);
+
+ sendResponse(packet, null, false, false);
}
public void handleCommit(final Packet packet)
@@ -728,9 +714,7 @@
tx = new TransactionImpl(storageManager);
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleRollback(final RollbackMessage packet)
@@ -757,9 +741,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXACommit(final SessionXACommitMessage packet)
@@ -820,9 +802,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAEnd(final SessionXAEndMessage packet)
@@ -894,9 +874,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAForget(final SessionXAForgetMessage packet)
@@ -906,9 +884,7 @@
Packet response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAJoin(final SessionXAJoinMessage packet)
@@ -957,9 +933,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAResume(final SessionXAResumeMessage packet)
@@ -1019,9 +993,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXARollback(final SessionXARollbackMessage packet)
@@ -1082,9 +1054,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAStart(final SessionXAStartMessage packet)
@@ -1133,9 +1103,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXASuspend(final Packet packet)
@@ -1182,9 +1150,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleXAPrepare(final SessionXAPrepareMessage packet)
@@ -1242,43 +1208,35 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleGetInDoubtXids(final Packet packet)
{
Packet response = new SessionXAGetInDoubtXidsResponseMessage(resourceManager.getPreparedTransactions());
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleGetXATimeout(final Packet packet)
{
Packet response = new SessionXAGetTimeoutResponseMessage(resourceManager.getTimeoutSeconds());
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleSetXATimeout(final SessionXASetTimeoutMessage packet)
{
Packet response = new SessionXASetTimeoutResponseMessage(resourceManager.setTimeoutSeconds(packet.getTimeoutSeconds()));
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleStart(final Packet packet)
{
setStarted(true);
- channel.confirm(packet);
+ sendResponse(packet, null, false, false);
}
public void handleStop(final Packet packet)
@@ -1287,9 +1245,7 @@
setStarted(false);
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleClose(final Packet packet)
@@ -1316,14 +1272,8 @@
}
}
- channel.confirm(packet);
+ sendResponse(packet, response, true, true);
- // We flush the confirmations to make sure any send confirmations get handled on the client side
- channel.flushConfirmations();
-
- channel.send(response);
-
- channel.close();
}
public void handleCloseConsumer(final SessionConsumerCloseMessage packet)
@@ -1359,9 +1309,7 @@
}
}
- channel.confirm(packet);
-
- channel.send(response);
+ sendResponse(packet, response, false, false);
}
public void handleReceiveConsumerCredits(final SessionConsumerFlowCreditMessage packet)
@@ -1383,7 +1331,8 @@
log.error("Failed to receive credits " + this.server.getConfiguration().isBackup(), e);
}
- channel.confirm(packet);
+
+ sendResponse(packet, null, false, false);
}
public void handleSendLargeMessage(final SessionSendLargeMessage packet)
@@ -1418,7 +1367,7 @@
log.error("Failed to send message", e);
}
- channel.confirm(packet);
+ sendResponse(packet, null, false, false);
}
public void handleSend(final SessionSendMessage packet)
@@ -1465,13 +1414,8 @@
}
}
}
-
- channel.confirm(packet);
-
- if (response != null)
- {
- channel.send(response);
- }
+
+ sendResponse(packet, response, false, false);
}
public void handleSendContinuations(final SessionSendContinuationMessage packet)
@@ -1520,12 +1464,7 @@
}
}
- channel.confirm(packet);
-
- if (response != null)
- {
- channel.send(response);
- }
+ sendResponse(packet, response, false, false);
}
public int transferConnection(final RemotingConnection newConnection, final int lastReceivedCommandID)
@@ -1638,6 +1577,50 @@
// Private
// ----------------------------------------------------------------------------
+ /**
+ * Respond to client after replication
+ * @param packet
+ * @param response
+ */
+ private void sendResponse(final Packet confirmPacket, final Packet response, final boolean flush, final boolean closeChannel)
+ {
+ Runnable action = new Runnable()
+ {
+ public void run()
+ {
+ if (confirmPacket != null)
+ {
+ channel.confirm(confirmPacket);
+ if (flush)
+ {
+ channel.flushConfirmations();
+ }
+ }
+
+ if (response != null)
+ {
+ channel.send(response);
+ }
+
+ if (closeChannel)
+ {
+ channel.close();
+ }
+ }
+ };
+
+ if (storageManager.isReplicated())
+ {
+ storageManager.afterReplicated(action);
+ storageManager.completeReplication();
+ }
+ else
+ {
+ action.run();
+ }
+ }
+
+
private void setStarted(final boolean s)
{
Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values());
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2009-10-05 15:13:57 UTC (rev 8044)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2009-10-05 19:18:07 UTC (rev 8045)
@@ -201,7 +201,61 @@
server.stop();
}
}
+
+ public void testNoActions() throws Exception
+ {
+ Configuration config = createDefaultConfig(false);
+
+ config.setBackup(true);
+
+ HornetQServer server = new HornetQServerImpl(config);
+
+ server.start();
+
+ try
+ {
+ ReplicationManagerImpl manager = new ReplicationManagerImpl(connectionManager, executor);
+ manager.start();
+
+ Journal replicatedJournal = new ReplicatedJournalImpl((byte)1, new FakeJournal(), manager);
+
+ replicatedJournal.appendPrepareRecord(1, new FakeData(), false);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ manager.afterReplicated(new Runnable()
+ {
+
+ public void run()
+ {
+ latch.countDown();
+ }
+
+ });
+ assertTrue(latch.await(1, TimeUnit.SECONDS));
+ assertEquals(1, manager.getActiveTokens().size());
+
+ manager.completeToken();
+
+ for (int i = 0; i < 100; i++)
+ {
+ // This is asynchronous. Have to wait completion
+ if (manager.getActiveTokens().size() == 0)
+ {
+ break;
+ }
+ Thread.sleep(1);
+ }
+
+ assertEquals(0, manager.getActiveTokens().size());
+ manager.stop();
+ }
+ finally
+ {
+ server.stop();
+ }
+ }
+
class FakeData implements EncodingSupport
{
16 years, 2 months
JBoss hornetq SVN: r8044 - in branches/Replication_Clebert: src/main/org/hornetq/core/persistence/impl/journal and 7 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-05 11:13:57 -0400 (Mon, 05 Oct 2009)
New Revision: 8044
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/ReplicationManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/QueueImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
Changes
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -44,6 +44,10 @@
{
// Message related operations
+ boolean isReplicated();
+
+ void afterReplicated(Runnable run);
+
UUID getPersistentID();
void setPersistentID(UUID id) throws Exception;
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -54,6 +54,8 @@
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.remoting.impl.wireformat.XidCodecSupport;
import org.hornetq.core.remoting.spi.HornetQBuffer;
+import org.hornetq.core.replication.ReplicationManager;
+import org.hornetq.core.replication.impl.ReplicatedJournalImpl;
import org.hornetq.core.server.JournalType;
import org.hornetq.core.server.LargeServerMessage;
import org.hornetq.core.server.MessageReference;
@@ -116,6 +118,8 @@
private UUID persistentID;
private final BatchingIDGenerator idGenerator;
+
+ private final ReplicationManager replicator;
private final Journal messageJournal;
@@ -145,7 +149,14 @@
public JournalStorageManager(final Configuration config, final Executor executor)
{
+ this (config, executor, null);
+ }
+
+ public JournalStorageManager(final Configuration config, final Executor executor, final ReplicationManager replicator)
+ {
this.executor = executor;
+
+ this.replicator = replicator;
if (config.getJournalType() != JournalType.NIO && config.getJournalType() != JournalType.ASYNCIO)
{
@@ -166,7 +177,7 @@
SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir);
- bindingsJournal = new JournalImpl(1024 * 1024,
+ Journal localBindings = new JournalImpl(1024 * 1024,
2,
config.getJournalCompactMinFiles(),
config.getJournalCompactPercentage(),
@@ -174,6 +185,15 @@
"hornetq-bindings",
"bindings",
1);
+
+ if (replicator != null)
+ {
+ this.bindingsJournal = new ReplicatedJournalImpl((byte)0, localBindings, replicator);
+ }
+ else
+ {
+ this.bindingsJournal = localBindings;
+ }
if (journalDir == null)
{
@@ -218,7 +238,7 @@
this.idGenerator = new BatchingIDGenerator(0, CHECKPOINT_BATCH_SIZE, bindingsJournal);
- messageJournal = new JournalImpl(config.getJournalFileSize(),
+ Journal localMessage = new JournalImpl(config.getJournalFileSize(),
config.getJournalMinFiles(),
config.getJournalCompactMinFiles(),
config.getJournalCompactPercentage(),
@@ -227,13 +247,39 @@
"hq",
config.getJournalMaxAIO());
+
+ if (replicator != null)
+ {
+ this.messageJournal = new ReplicatedJournalImpl((byte)1, localMessage, replicator);
+ }
+ else
+ {
+ this.messageJournal = localBindings;
+ }
+
+
largeMessagesDirectory = config.getLargeMessagesDirectory();
largeMessagesFactory = new NIOSequentialFileFactory(largeMessagesDirectory);
perfBlastPages = config.getJournalPerfBlastPages();
}
+
+ public boolean isReplicated()
+ {
+ return replicator != null;
+ }
+
+ public void afterReplicated(Runnable run)
+ {
+ if (replicator == null)
+ {
+ throw new IllegalStateException("StorageManager is not replicated");
+ }
+ replicator.afterReplicated(run);
+ }
+
public UUID getPersistentID()
{
return persistentID;
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -245,4 +245,20 @@
{
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterReplicated(java.lang.Runnable)
+ */
+ public void afterReplicated(Runnable run)
+ {
+ run.run();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#isReplicated()
+ */
+ public boolean isReplicated()
+ {
+ return false;
+ }
+
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/ReplicationManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/ReplicationManager.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/ReplicationManager.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -46,7 +46,7 @@
void appendRollbackRecord(byte journalID, long txID) throws Exception;
/** Add an action to be executed after the pending replications */
- void addReplicationAction(Runnable runnable);
+ void afterReplicated(Runnable runnable);
void completeToken();
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -284,7 +284,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.replication.ReplicationManager#addReplicationAction(java.lang.Runnable)
*/
- public void addReplicationAction(final Runnable runnable)
+ public void afterReplicated(final Runnable runnable)
{
getReplicationToken().addReplicationAction(runnable);
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -887,7 +887,7 @@
{
if (configuration.isPersistenceEnabled())
{
- return new JournalStorageManager(configuration, threadPool);
+ return new JournalStorageManager(configuration, threadPool, replicationManager);
}
else
{
@@ -981,6 +981,9 @@
deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
}
+
+ startReplication();
+
this.storageManager = createStorageManager();
securityRepository = new HierarchicalObjectRepository<Set<Role>>();
@@ -1123,8 +1126,6 @@
}
}, 0, dumpInfoInterval, TimeUnit.MILLISECONDS);
}
-
- startReplication();
initialised = true;
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -239,7 +239,7 @@
boolean durableRef = message.isDurable() && durable;
// If durable, must be persisted before anything is routed
- MessageReference ref = message.createReference(this);
+ final MessageReference ref = message.createReference(this);
PagingStore store = pagingManager.getPageStore(message.getDestination());
@@ -270,8 +270,20 @@
{
storageManager.updateScheduledDeliveryTime(ref);
}
-
- addLast(ref);
+
+ if (storageManager.isReplicated())
+ {
+ storageManager.afterReplicated(new Runnable(){
+ public void run()
+ {
+ addLast(ref);
+ }
+ });
+ }
+ else
+ {
+ addLast(ref);
+ }
}
else
{
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -229,21 +229,51 @@
operation.beforeCommit(this);
}
}
+
+ // TODO: Verify Exception handling here with Tim
+ Runnable execAfterCommit = null;
+
+ if (operations != null)
+ {
+ execAfterCommit = new Runnable()
+ {
+ public void run()
+ {
+ for (TransactionOperation operation : operations)
+ {
+ try
+ {
+ operation.afterCommit(TransactionImpl.this);
+ }
+ catch (Exception e)
+ {
+ log.warn(e.getMessage(), e);
+ }
+ }
+ }
+ };
+ }
if ((getProperty(TransactionPropertyIndexes.CONTAINS_PERSISTENT) != null) || (xid != null && state == State.PREPARED))
{
storageManager.commit(id);
- }
-
- state = State.COMMITTED;
-
- if (operations != null)
- {
- for (TransactionOperation operation : operations)
+ state = State.COMMITTED;
+ if (execAfterCommit != null)
{
- operation.afterCommit(this);
+ if (storageManager.isReplicated())
+ {
+ storageManager.afterReplicated(execAfterCommit);
+ }
}
+ else if (execAfterCommit != null)
+ {
+ execAfterCommit.run();
+ }
}
+ else if (execAfterCommit != null)
+ {
+ execAfterCommit.run();
+ }
}
}
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -169,7 +169,7 @@
replicatedJournal.appendRollbackRecord(3, false);
final CountDownLatch latch = new CountDownLatch(1);
- manager.addReplicationAction(new Runnable()
+ manager.afterReplicated(new Runnable()
{
public void run()
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-10-05 12:54:00 UTC (rev 8043)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-10-05 15:13:57 UTC (rev 8044)
@@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
@@ -25,8 +24,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import javax.transaction.xa.Xid;
-
import org.hornetq.core.buffers.ChannelBuffers;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
@@ -41,26 +38,19 @@
import org.hornetq.core.paging.impl.PagedMessageImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.paging.impl.TestSupportPageStore;
-import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.postoffice.Binding;
+import org.hornetq.core.persistence.impl.nullpm.NullStorageManager;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.remoting.spi.HornetQBuffer;
-import org.hornetq.core.server.LargeServerMessage;
-import org.hornetq.core.server.MessageReference;
-import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressSettings;
-import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
import org.hornetq.tests.unit.core.server.impl.fakes.FakePostOffice;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.Pair;
import org.hornetq.utils.SimpleString;
-import org.hornetq.utils.UUID;
/**
*
@@ -835,273 +825,9 @@
}
- class FakeStorageManager implements StorageManager
+ class FakeStorageManager extends NullStorageManager
{
- public void setUniqueIDSequence(long id)
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#addQueueBinding(org.hornetq.core.postoffice.Binding)
- */
- public void addQueueBinding(final Binding binding) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#commit(long)
- */
- public void commit(final long txID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#createLargeMessage()
- */
- public LargeServerMessage createLargeMessage()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateID(long)
- */
- public void deleteDuplicateID(final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateIDTransactional(long, long)
- */
- public void deleteDuplicateIDTransactional(final long txID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteMessage(long)
- */
- public void deleteMessage(final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteMessageTransactional(long, long, long)
- */
- public void deleteMessageTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long, long)
- */
- public void deletePageTransactional(final long txID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteQueueBinding(long)
- */
- public void deleteQueueBinding(final long queueBindingID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#generateUniqueID()
- */
- public long generateUniqueID()
- {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#getCurrentUniqueID()
- */
- public long getCurrentUniqueID()
- {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#getPersistentID()
- */
- public UUID getPersistentID()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadBindingJournal(java.util.List)
- */
- public void loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadMessageJournal(org.hornetq.core.paging.PagingManager, java.util.Map, org.hornetq.core.transaction.ResourceManager, java.util.Map)
- */
- public void loadMessageJournal(PagingManager pagingManager,
- ResourceManager resourceManager,
- Map<Long, Queue> queues,
- Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#prepare(long, javax.transaction.xa.Xid)
- */
- public void prepare(final long txID, final Xid xid) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#rollback(long)
- */
- public void rollback(final long txID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#setPersistentID(org.hornetq.utils.UUID)
- */
- public void setPersistentID(final UUID id) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAcknowledge(long, long)
- */
- public void storeAcknowledge(final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAcknowledgeTransactional(long, long, long)
- */
- public void storeAcknowledgeTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
- */
- public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
- */
- public void storeDuplicateIDTransactional(final long txID,
- final SimpleString address,
- final byte[] duplID,
- final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeMessage(org.hornetq.core.server.ServerMessage)
- */
- public void storeMessage(final ServerMessage message) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeMessageTransactional(long, org.hornetq.core.server.ServerMessage)
- */
- public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo)
- */
- public void storePageTransaction(final long txID, final PageTransactionInfo pageTransaction) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeReference(long, long)
- */
- public void storeReference(final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeReferenceTransactional(long, long, long)
- */
- public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDeliveryCount(org.hornetq.core.server.MessageReference)
- */
- public void updateDeliveryCount(final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
- */
- public void updateDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
- */
- public void updateDuplicateIDTransactional(final long txID,
- final SimpleString address,
- final byte[] duplID,
- final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTime(org.hornetq.core.server.MessageReference)
- */
- public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTimeTransactional(long, org.hornetq.core.server.MessageReference)
- */
- public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#isStarted()
- */
- public boolean isStarted()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#start()
- */
- public void start() throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#stop()
- */
- public void stop() throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadInternalOnly()
- */
- public void loadInternalOnly() throws Exception
- {
- }
-
}
class FakeStoreFactory implements PagingStoreFactory
16 years, 2 months
JBoss hornetq SVN: r8043 - in trunk: src/main/org/hornetq/jms/client and 1 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-10-05 08:54:00 -0400 (Mon, 05 Oct 2009)
New Revision: 8043
Modified:
trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
Log:
fixed tests
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2009-10-05 08:49:23 UTC (rev 8042)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
@@ -224,7 +224,6 @@
}
else if (sendBlocking)
{
- //log.info("sending blocking");
channel.sendBlocking(message);
}
else
Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2009-10-05 08:49:23 UTC (rev 8042)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2009-10-05 12:54:00 UTC (rev 8043)
@@ -490,7 +490,7 @@
boolean done = false;
synchronized (failoverLock)
- {
+ {
if (connection == null || connection.getID() != connectionID)
{
// We already failed over/reconnected - probably the first failure came in, all the connections were failed
@@ -541,7 +541,7 @@
{
attemptReconnect = reconnectAttempts != 0;
}
-
+
if (attemptFailover || attemptReconnect)
{
lockChannel1();
@@ -628,6 +628,12 @@
oldConnection.destroy();
}
}
+ else
+ {
+ connection.destroy();
+
+ connection = null;
+ }
// We always call the failure listeners
callFailureListeners(me);
Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnection.java 2009-10-05 08:49:23 UTC (rev 8042)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnection.java 2009-10-05 12:54:00 UTC (rev 8043)
@@ -541,6 +541,8 @@
try
{
initialSession = sessionFactory.createSession(username, password, false, false, false, false, 0);
+
+ initialSession.addFailureListener(listener);
}
catch (HornetQException me)
{
@@ -565,7 +567,7 @@
{
return;
}
-
+
HornetQConnection conn = connectionRef.get();
if (conn != null)
Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2009-10-05 08:49:23 UTC (rev 8042)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2009-10-05 12:54:00 UTC (rev 8043)
@@ -271,7 +271,7 @@
ClientSession session2 = sf.createSession(false, true, true);
ClientSession session3 = sf.createSession(false, true, true);
- assertEquals(3, server.getRemotingService().getConnections().size());
+ assertEquals(1, server.getRemotingService().getConnections().size());
WeakReference<ClientSession> ref1 = new WeakReference<ClientSession> (session1);
WeakReference<ClientSession> ref2 = new WeakReference<ClientSession> (session2);
16 years, 2 months