tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1076878 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/Assembler.java config/RemoteServer.java core/timer/EjbTimerServiceImpl.java
Date Thu, 03 Mar 2011 23:23:12 GMT
Author: dblevins
Date: Thu Mar  3 23:23:12 2011
New Revision: 1076878

URL: http://svn.apache.org/viewvc?rev=1076878&view=rev
Log:
Shutdown the EjbTimerServiceImpl on Assembler.destroy() to prevent the server from hanging
on shutdown when timers are used.

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1076878&r1=1076877&r2=1076878&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Thu Mar  3 23:23:12 2011
@@ -89,6 +89,7 @@ import org.apache.openejb.core.transacti
 import org.apache.openejb.core.transaction.TransactionPolicyFactory;
 import org.apache.openejb.core.transaction.TransactionType;
 import org.apache.openejb.javaagent.Agent;
+import org.apache.openejb.jee.sun.Default;
 import org.apache.openejb.loader.Options;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.persistence.JtaEntityManagerRegistry;
@@ -823,6 +824,13 @@ public class Assembler extends Assembler
     }
 
     public void destroy() {
+
+        try {
+            EjbTimerServiceImpl.shutdown();
+        } catch (Exception e) {
+            logger.warning("Unable to shutdown scheduler", e);
+        }
+
         logger.debug("Undeploying Applications");
         Assembler assembler = this;
         for (AppInfo appInfo : assembler.getDeployedApplications()) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java?rev=1076878&r1=1076877&r2=1076878&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
Thu Mar  3 23:23:12 2011
@@ -135,6 +135,7 @@ public class RemoteServer {
                     }
                 } else {
                     File bin = new File(home, "bin");
+                    File tlib = new File(home, "lib");
                     File bootstrapJar = new File(bin, "bootstrap.jar");
                     File juliJar = new File(bin, "tomcat-juli.jar");
                     File commonsLoggingJar = new File(bin, "commons-logging-api.jar");
@@ -164,6 +165,7 @@ public class RemoteServer {
                                 "-Djava.endorsed.dirs=" + endorsed.getAbsolutePath(),
                                 "-Dcatalina.base=" + home.getAbsolutePath(),
                                 "-Dcatalina.home=" + home.getAbsolutePath(),
+                                "-Dcatalina.ext.dirs=" + tlib.getAbsolutePath(),
                                 "-Dopenejb.servicemanager.enabled=" + Boolean.getBoolean("openejb.servicemanager.enabled"),
 
                                 "-classpath", bootstrapJar.getAbsolutePath() + ":" + juliJar.getAbsolutePath()
+ ":"+ commonsLoggingJar.getAbsolutePath(),
@@ -184,6 +186,7 @@ public class RemoteServer {
                                 "-Djava.endorsed.dirs=" + endorsed.getAbsolutePath(),
                                 "-Dcatalina.base=" + home.getAbsolutePath(),
                                 "-Dcatalina.home=" + home.getAbsolutePath(),
+                                "-Dcatalina.ext.dirs=" + tlib.getAbsolutePath(),
                                 "-Dopenejb.servicemanager.enabled=" + Boolean.getBoolean("openejb.servicemanager.enabled"),
 
                                 "-classpath", bootstrapJar.getAbsolutePath() + ":" + juliJar.getAbsolutePath()
+ ":" + commonsLoggingJar.getAbsolutePath(),

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java?rev=1076878&r1=1076877&r2=1076878&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
Thu Mar  3 23:23:12 2011
@@ -103,6 +103,16 @@ public class EjbTimerServiceImpl impleme
         return scheduler;
     }
 
+    public static void shutdown() {
+
+        Scheduler scheduler = SystemInstance.get().getComponent(Scheduler.class);
+        if (scheduler != null) try {
+            scheduler.shutdown();
+        } catch (SchedulerException e) {
+            throw new RuntimeException("Unable to shutdown scheduler", e);
+        }
+
+    }
     public void start() throws TimerStoreException {
          // load saved timers
         Collection<TimerData> timerDatas = timerStore.loadTimers(this, (String)deployment.getDeploymentID());



Mime
View raw message