geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1231354 - /geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
Date Fri, 13 Jan 2012 22:27:24 GMT
Author: djencks
Date: Fri Jan 13 22:27:24 2012
New Revision: 1231354

URL: http://svn.apache.org/viewvc?rev=1231354&view=rev
Log:
GERONIMO-6263 remove usage of Daemon, stop and restart g. using osgi framework stop/update
(not tested)

Modified:
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java?rev=1231354&r1=1231353&r2=1231354&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
Fri Jan 13 22:27:24 2012
@@ -27,12 +27,14 @@ import javax.portlet.PortletRequestDispa
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.system.main.Daemon;
 
 public class ServerManagerPortlet extends BasePortlet {
 
@@ -48,22 +50,33 @@ public class ServerManagerPortlet extend
 
     public void processAction(ActionRequest actionRequest,
             ActionResponse actionResponse) throws PortletException, IOException {
+        Bundle framework = ((BundleReference)getClass().getClassLoader()).getBundle().getBundleContext().getBundle(0);
         if (actionRequest.getParameter("reboot") != null) {
             log.info("Reboot initiated by user request: " + actionRequest.getUserPrincipal().getName());
-            new Thread() {
-                public void run() {
-                    try {
-                        Thread.sleep(2000);
-                    } catch (InterruptedException e) {
-                    }
-                    kernel.shutdown();
-                    Daemon.main(new String[0]);
-                }
-            }.start();
+            try {
+                framework.update();
+            } catch (BundleException e) {
+                log.info("Problem rebooting", e);
+            }
+//            new Thread() {
+//                public void run() {
+//                    try {
+//                        Thread.sleep(2000);
+//                    } catch (InterruptedException e) {
+//                    }
+//                    kernel.shutdown();
+//                    Daemon.main(new String[0]);
+//                }
+//            }.start();
         } else if(actionRequest.getParameter("shutdown") != null) {
             log.info("Shutting down by user request: " + actionRequest.getUserPrincipal().getName());
-            kernel.shutdown();
-            System.exit(0);
+//            kernel.shutdown();
+//            System.exit(0);
+            try {
+                framework.stop();
+            } catch (BundleException e) {
+                log.info("Problem rebooting", e);
+            }
         }
     }
 



Mime
View raw message