tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject tomee git commit: #TOMEE-1489 - Add scheduler support for kahadb
Date Thu, 08 Jan 2015 13:14:24 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop caa0edbc3 -> 7bdc9e2f0


#TOMEE-1489 - Add scheduler support for kahadb


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/7bdc9e2f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/7bdc9e2f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/7bdc9e2f

Branch: refs/heads/develop
Commit: 7bdc9e2f05694257c83f7abc7f4360ad921018d2
Parents: caa0edb
Author: AndyGee <andy.is@gmx.de>
Authored: Thu Jan 8 14:14:10 2015 +0100
Committer: AndyGee <andy.is@gmx.de>
Committed: Thu Jan 8 14:14:19 2015 +0100

----------------------------------------------------------------------
 .../resource/activemq/ActiveMQ5Factory.java     | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/7bdc9e2f/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
index 145b18c..fdfe64d 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
@@ -70,12 +70,18 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
         if (null == broker || !broker.isStarted()) {
 
             final Properties properties = getLowerCaseProperties();
+            boolean scheduleSupport = false;
 
             final URISupport.CompositeData compositeData = URISupport.parseComposite(new
URI(brokerURI.getRawSchemeSpecificPart()));
             final Map<String, String> params = new HashMap<String, String>(compositeData.getParameters());
             final PersistenceAdapter persistenceAdapter;
             if ("true".equals(params.remove("usekahadb"))) {
                 persistenceAdapter = createPersistenceAdapter("org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter",
"kahadb", params);
+
+                if ("true".equals(params.remove("scheduler"))) {
+                    scheduleSupport = true;
+                }
+
             } else if ("true".equals(params.remove("useleveldb"))) {
                 persistenceAdapter = createPersistenceAdapter("org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter",
"leveldb", params);
             } else if (params.get("persistenceadapter") != null) {
@@ -89,6 +95,8 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
             broker = BrokerFactory.createBroker(uri);
             brokers.put(brokerURI, broker);
 
+            broker.setSchedulerSupport(scheduleSupport);
+
             if (persistenceAdapter != null) {
                 broker.setPersistenceAdapter(persistenceAdapter);
                 // if user didn't set persistent to true then setPersistenceAdapter() alone
is ignored so forcing it with the factory
@@ -285,23 +293,11 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
     }
 
     private void tomeeConfig(final BrokerService broker) {
-        //New since 5.4.x
-        disableScheduler(broker);
 
         //Notify when an error occurs on shutdown.
         broker.setUseLoggingForShutdownErrors(Logger.getInstance(LogCategory.OPENEJB_STARTUP,
ActiveMQ5Factory.class).isErrorEnabled());
     }
 
-    private static void disableScheduler(final BrokerService broker) {
-        try {
-            final Class<?> clazz = Class.forName("org.apache.activemq.broker.BrokerService");
-            final Method method = clazz.getMethod("setSchedulerSupport", new Class[]{Boolean.class});
-            method.invoke(broker, Boolean.FALSE);
-        } catch (final Throwable e) {
-            //Ignore
-        }
-    }
-
     private Properties getLowerCaseProperties() {
         final Properties newProperties = new Properties();
         if (properties != null) {


Mime
View raw message