You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/02/20 16:03:44 UTC

svn commit: r629493 - /servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java

Author: gnodet
Date: Wed Feb 20 07:03:42 2008
New Revision: 629493

URL: http://svn.apache.org/viewvc?rev=629493&view=rev
Log:
SM-1240: Fix the jbi:embeddedServicemix goal

Modified:
    servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java

Modified: servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java?rev=629493&r1=629492&r2=629493&view=diff
==============================================================================
--- servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java (original)
+++ servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java Wed Feb 20 07:03:42 2008
@@ -19,7 +19,6 @@
 import java.io.File;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.servicemix.jbi.container.SpringJBIContainer;
 import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
 import org.springframework.beans.factory.DisposableBean;
 
@@ -44,28 +43,25 @@
 
     private FileSystemXmlApplicationContext context;
 
-    private SpringJBIContainer container;
-
     public void execute() throws MojoExecutionException, MojoFailureException {
 
         try {
             startServiceMix();
 
-            container.onShutDown(new Runnable() {
-                public void run() {
-                    if (context instanceof DisposableBean) {
-                        try {
-                            ((DisposableBean) context).destroy();
-                        } catch (Exception e) {
-                            // Ignore
-                        }
-                    }
-
+            while (true) {
+                Thread.sleep(1000);
+            }
+
+        } catch (InterruptedException e) {
+            throw new MojoFailureException("Interrupted");
+        } finally {
+            if (context instanceof DisposableBean) {
+                try {
+                    ((DisposableBean) context).destroy();
+                } catch (Exception e) {
+                    // Ignore
                 }
-            });
-        } catch (Exception e) {
-            throw new MojoExecutionException(
-                    "Apache ServiceMix was able to deploy project", e);
+            }
         } 
 
     }
@@ -76,7 +72,7 @@
             Thread.currentThread().setContextClassLoader(getClassLoader());
             context = new FileSystemXmlApplicationContext("file:///"
                     + servicemixConfig.getAbsolutePath());
-            container = (SpringJBIContainer) context.getBean("jbi");
+            context.getBean("jbi");
         } catch (Exception e) {
             throw new MojoExecutionException(
                     "Unable to start the ServiceMix container", e);