tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1510498 - /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java
Date Mon, 05 Aug 2013 14:28:26 GMT
Author: rmannibucau
Date: Mon Aug  5 14:28:26 2013
New Revision: 1510498

URL: http://svn.apache.org/r1510498
Log:
TOMEE-1012 AsynchronousPool.RejectedExecutionHandlerClass = ....

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java?rev=1510498&r1=1510497&r2=1510498&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/ExecutorBuilder.java
Mon Aug  5 14:28:26 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb.util;
 
+import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.loader.Options;
 import org.apache.openejb.util.executor.OfferRejectedExecutionHandler;
 
@@ -98,8 +99,17 @@ public class ExecutorBuilder {
 
         RejectedExecutionHandler handler = this.rejectedExecutionHandler;
         if (handler == null) {
-            final Duration duration = options.get(prefix + ".OfferTimeout", new Duration(30,
TimeUnit.SECONDS));
-            handler = new OfferRejectedExecutionHandler(duration);
+            final String rejectedExecutionHandlerClass = options.get(prefix + ".RejectedExecutionHandlerClass",
(String) null);
+            if (rejectedExecutionHandlerClass == null) {
+                final Duration duration = options.get(prefix + ".OfferTimeout", new Duration(30,
TimeUnit.SECONDS));
+                handler = new OfferRejectedExecutionHandler(duration);
+            } else {
+                try {
+                    handler = RejectedExecutionHandler.class.cast(Thread.currentThread().getContextClassLoader().loadClass(rejectedExecutionHandlerClass).newInstance());
+                } catch (final Exception e) {
+                    throw new OpenEJBRuntimeException(e);
+                }
+            }
         }
 
         final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize



Mime
View raw message