Author: dejanb Date: Fri Feb 26 14:15:44 2010 New Revision: 916686 URL: http://svn.apache.org/viewvc?rev=916686&view=rev Log: merging 910238,911784 - https://issues.apache.org/activemq/browse/AMQ-2599 - Distribution activemq.xml does not match distribution activemq.xsd Added: activemq/branches/activemq-5.3/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java - copied unchanged from r910238, activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java activemq/branches/activemq-5.3/assembly/src/test/java/org/apache/activemq/config/ValidateXMLConfigTest.java - copied unchanged from r910238, activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ValidateXMLConfigTest.java Removed: activemq/branches/activemq-5.3/assembly/src/sample-conf/quickMem-example.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/rapid-example.xml activemq/branches/activemq-5.3/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java activemq/branches/activemq-5.3/assembly/pom.xml activemq/branches/activemq-5.3/assembly/src/main/descriptors/common-bin.xml activemq/branches/activemq-5.3/assembly/src/release/conf/activemq.xml activemq/branches/activemq-5.3/assembly/src/release/conf/camel.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-command.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-demo.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker1.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker2.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-jdbc.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-security.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker1.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker2.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/journaledMem-example.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/kaha-example.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/memory-example.xml activemq/branches/activemq-5.3/assembly/src/sample-conf/quickJdbc-example.xml activemq/branches/activemq-5.3/pom.xml Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java (original) +++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java Fri Feb 26 14:15:44 2010 @@ -594,7 +594,7 @@ stopper.throwFirstException(); } - public boolean checkQueueSize(String queueName) { + public boolean checkQueueSize(String queueName) { long count = 0; long queueSize = 0; Map destinationMap = regionBroker.getDestinationMap(); Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java (original) +++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java Fri Feb 26 14:15:44 2010 @@ -88,8 +88,8 @@ protected static final Scheduler scheduler = Scheduler.getInstance(); private static final Log LOG = LogFactory.getLog(JournalPersistenceAdapter.class); - private final Journal journal; - private final PersistenceAdapter longTermPersistence; + private Journal journal; + private PersistenceAdapter longTermPersistence; private final WireFormat wireFormat = new OpenWireFormat(); @@ -114,20 +114,27 @@ private final Runnable periodicCheckpointTask = createPeriodicCheckpointTask(); + private TaskRunnerFactory taskRunnerFactory; + public JournalPersistenceAdapter(Journal journal, PersistenceAdapter longTermPersistence, TaskRunnerFactory taskRunnerFactory) throws IOException { + setJournal(journal); + setTaskRunnerFactory(taskRunnerFactory); + setPersistenceAdapter(longTermPersistence); + } + + public void setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory) { + this.taskRunnerFactory = taskRunnerFactory; + } + public void setJournal(Journal journal) { this.journal = journal; journal.setJournalEventListener(this); - - checkpointTask = taskRunnerFactory.createTaskRunner(new Task() { - public boolean iterate() { - return doCheckpoint(); - } - }, "ActiveMQ Journal Checkpoint Worker"); - + } + + public void setPersistenceAdapter(PersistenceAdapter longTermPersistence) { this.longTermPersistence = longTermPersistence; } - + final Runnable createPeriodicCheckpointTask() { return new Runnable() { public void run() { @@ -229,6 +236,12 @@ return; } + checkpointTask = taskRunnerFactory.createTaskRunner(new Task() { + public boolean iterate() { + return doCheckpoint(); + } + }, "ActiveMQ Journal Checkpoint Worker"); + checkpointExecutor = new ThreadPoolExecutor(maxCheckpointWorkers, maxCheckpointWorkers, 30, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() { public Thread newThread(Runnable runable) { Thread t = new Thread(runable, "Journal checkpoint worker"); Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java (original) +++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java Fri Feb 26 14:15:44 2010 @@ -195,4 +195,10 @@ public long size(){ return 0; } + + public void setCreateTransactionStore(boolean create) throws IOException { + if (create) { + createTransactionStore(); + } + } } Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java (original) +++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java Fri Feb 26 14:15:44 2010 @@ -20,14 +20,13 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; + import org.apache.activemq.broker.BrokerService; import org.apache.activemq.usage.SystemUsage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleException; import org.springframework.beans.BeansException; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; @@ -53,7 +52,24 @@ private boolean start = true; private ApplicationContext applicationContext = null; private boolean destroyApplicationContextOnShutdown = false; + private boolean destroyApplicationContextOnStop = false; + + Runnable stopContextRunnable = new Runnable() { + public void run() { + if (applicationContext instanceof ConfigurableApplicationContext) { + ((ConfigurableApplicationContext) applicationContext).close(); + } + if (applicationContext instanceof OsgiBundleXmlApplicationContext){ + try { + ((OsgiBundleXmlApplicationContext)applicationContext).getBundle().stop(); + } catch (BundleException e) { + LOG.info("Error stopping OSGi bundle " + e, e); + } + } + } + }; + public XBeanBrokerService() { } @@ -69,21 +85,7 @@ start(); } if (destroyApplicationContextOnShutdown) { - addShutdownHook(new Runnable() { - public void run() { - if (applicationContext instanceof ConfigurableApplicationContext) { - ((ConfigurableApplicationContext) applicationContext).close(); - } - if (applicationContext instanceof OsgiBundleXmlApplicationContext){ - try { - ((OsgiBundleXmlApplicationContext)applicationContext).getBundle().stop(); - } catch (BundleException e) { - LOG.info("Error stopping OSGi bundle " + e, e); - } - } - - } - }); + addShutdownHook(stopContextRunnable); } } @@ -107,9 +109,15 @@ stop(); } - public boolean isStart() { - return start; - } + + @Override + public void stop() throws Exception { + if (destroyApplicationContextOnStop) { + stopContextRunnable.run(); + } + super.stop(); + } + /** * Sets whether or not the broker is started along with the ApplicationContext it is defined within. @@ -121,12 +129,20 @@ } /** - * Sets whether the broker should shutdown the ApplicationContext when the broker is stopped. + * Sets whether the broker should shutdown the ApplicationContext when the broker jvm is shutdown. * The broker can be stopped because the underlying JDBC store is unavailable for example. */ public void setDestroyApplicationContextOnShutdown(boolean destroy) { this.destroyApplicationContextOnShutdown = destroy; } + + /** + * Sets whether the broker should shutdown the ApplicationContext when the broker is stopped. + * The broker can be stopped because the underlying JDBC store is unavailable for example. + */ + public void setDestroyApplicationContextOnStop(boolean destroy) { + this.destroyApplicationContextOnStop = destroy; + } public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { Modified: activemq/branches/activemq-5.3/assembly/pom.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/pom.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/pom.xml (original) +++ activemq/branches/activemq-5.3/assembly/pom.xml Fri Feb 26 14:15:44 2010 @@ -224,7 +224,10 @@ org.apache.geronimo.specs geronimo-jta_1.0.1B_spec - + + org.osgi + org.osgi.core + org.apache.xbean xbean-spring @@ -325,6 +328,11 @@ junit test + + org.osgi + org.osgi.core + test + @@ -370,9 +378,18 @@ maven-surefire-plugin - - pertest - + + + validate-config + test + + test + + + pertest + + + org.apache.maven.plugins @@ -417,6 +434,30 @@ broker:(tcp://localhost:61616)?useJmx=false + + org.apache.maven.plugins + maven-resources-plugin + + + copy-conf + process-test-resources + + copy-resources + + + target/conf + + + src/release/conf + + + src/sample-conf + + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/main/descriptors/common-bin.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/main/descriptors/common-bin.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/main/descriptors/common-bin.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/main/descriptors/common-bin.xml Fri Feb 26 14:15:44 2010 @@ -157,13 +157,11 @@ runtime commons-logging:commons-logging - geronimo-jms_1.1_spec:geronimo-jms_1.1_spec ${pom.groupId}:activemq-core ${pom.groupId}:activemq-console ${pom.groupId}:activemq-jaas ${pom.groupId}:kahadb org.apache.activemq.protobuf:activemq-protobuf - mx4j:mx4j org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec org.apache.geronimo.specs:geronimo-jms_1.1_spec org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec @@ -192,7 +190,6 @@ ${pom.groupId}:activemq-optional ${pom.groupId}:activemq-pool ${pom.groupId}:activemq-xmpp - ${pom.groupId}:activecluster ${pom.groupId}:activeio-core ${pom.groupId}:activemq-jmdns_1.0 commons-beanutils:commons-beanutils @@ -204,12 +201,8 @@ commons-net:commons-net commons-lang:commons-lang log4j:log4j - mx4j:mx4j-remote - mx4j:mx4j-tools - org.apache.geronimo.specs:geronimo-j2ee-jacc_1.0_spec org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec org.apache.xbean:xbean-spring - org.mortbay.jetty:jetty-client org.springframework:spring-aop org.springframework:spring-core org.springframework:spring-beans @@ -218,12 +211,13 @@ org.springframework:spring-jms com.thoughtworks.xstream:xstream xmlpull:xmlpull - org.apache.hadoop.zookeeper:zookeeper org.codehaus.woodstox:wstx-asl org.springframework.ws:spring-oxm-tiger org.codehaus.jettison:jettison org.apache.velocity:velocity net.sf.josql:josql + org.osgi:org.osgi.core + org.springframework.osgi:spring-osgi-core Modified: activemq/branches/activemq-5.3/assembly/src/release/conf/activemq.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/release/conf/activemq.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/release/conf/activemq.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/release/conf/activemq.xml Fri Feb 26 14:15:44 2010 @@ -31,31 +31,8 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + + - org.foo.bar + org.foo.bar Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-command.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-command.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-command.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-command.xml Fri Feb 26 14:15:44 2010 @@ -25,7 +25,16 @@ e.g. $ bin/activemq xbean:conf/activemq-command.xml --> - + + + + + @@ -34,6 +43,7 @@ + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-demo.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-demo.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-demo.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-demo.xml Fri Feb 26 14:15:44 2010 @@ -23,11 +23,10 @@ --> + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + - - - - org.foo.bar + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker1.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker1.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker1.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker1.xml Fri Feb 26 14:15:44 2010 @@ -41,32 +41,6 @@ - - - - - - - - - - - - - - @@ -87,6 +61,20 @@ + + + + + @@ -106,6 +94,15 @@ + + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker2.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker2.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker2.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-dynamic-network-broker2.xml Fri Feb 26 14:15:44 2010 @@ -42,32 +42,6 @@ - - - - - - - - - - - - - - @@ -87,6 +61,21 @@ + + + + + + @@ -107,6 +96,14 @@ + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-jdbc.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-jdbc.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-jdbc.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-jdbc.xml Fri Feb 26 14:15:44 2010 @@ -28,7 +28,11 @@ e.g. $ bin/activemq xbean:conf/activemq-jdbc.xml --> - + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-security.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-security.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-security.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-security.xml Fri Feb 26 14:15:44 2010 @@ -38,7 +38,7 @@ - + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker1.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker1.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker1.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker1.xml Fri Feb 26 14:15:44 2010 @@ -43,23 +43,6 @@ - - - - - - - - - - - - - @@ -80,6 +63,14 @@ + + + + @@ -99,6 +90,11 @@ + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker2.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker2.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker2.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/activemq-static-network-broker2.xml Fri Feb 26 14:15:44 2010 @@ -43,23 +43,6 @@ - - - - - - - - - - - - - - @@ -80,6 +63,14 @@ + + + + + @@ -99,6 +90,11 @@ + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/journaledMem-example.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/journaledMem-example.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/journaledMem-example.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/journaledMem-example.xml Fri Feb 26 14:15:44 2010 @@ -16,29 +16,35 @@ limitations under the License. --> - + - - - - - + - + - - - + + + - + - + + + + + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/kaha-example.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/kaha-example.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/kaha-example.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/kaha-example.xml Fri Feb 26 14:15:44 2010 @@ -15,17 +15,25 @@ limitations under the License. --> - + + + + + + + - - - Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/memory-example.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/memory-example.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/memory-example.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/memory-example.xml Fri Feb 26 14:15:44 2010 @@ -15,8 +15,13 @@ limitations under the License. --> - - + + Modified: activemq/branches/activemq-5.3/assembly/src/sample-conf/quickJdbc-example.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/assembly/src/sample-conf/quickJdbc-example.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/assembly/src/sample-conf/quickJdbc-example.xml (original) +++ activemq/branches/activemq-5.3/assembly/src/sample-conf/quickJdbc-example.xml Fri Feb 26 14:15:44 2010 @@ -15,10 +15,14 @@ limitations under the License. --> - - + + - + - + Modified: activemq/branches/activemq-5.3/pom.xml URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/pom.xml?rev=916686&r1=916685&r2=916686&view=diff ============================================================================== --- activemq/branches/activemq-5.3/pom.xml (original) +++ activemq/branches/activemq-5.3/pom.xml Fri Feb 26 14:15:44 2010 @@ -422,7 +422,6 @@ org.osgi org.osgi.core 4.1.0 - provided