You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2009/07/23 08:24:05 UTC

svn commit: r796959 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core: Activator.java GeronimoServerBehaviourDelegate.java

Author: mcconne
Date: Thu Jul 23 06:24:04 2009
New Revision: 796959

URL: http://svn.apache.org/viewvc?rev=796959&view=rev
Log:
GERONIMODEVTOOLS-575 Handle the scenario where an exception occurs on the GEP side when stopping the server -- Thanks to Delos Dai for this patch !!

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/Activator.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/Activator.java?rev=796959&r1=796958&r2=796959&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/Activator.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/Activator.java Thu Jul 23 06:24:04 2009
@@ -68,6 +68,16 @@
         }
     }
 
+
+    /** 
+     * <b>triggerStartUpdateServerTask</b> is invoked from:
+     * <ul> 
+     * <li>The WTP ResourceManager after a new server has been defined (via the WTP NewServerWizard)
+     * <li>When a server lifecycle listener has been added (see above)
+     * </ul>
+     * 
+     * @param server 
+     */
     private void triggerStartUpdateServerTask(IServer server) {
         GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
         if (delegate == null) {
@@ -78,6 +88,7 @@
         }
     }
 
+
     /*
      * (non-Javadoc)
      *

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?rev=796959&r1=796958&r2=796959&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java Thu Jul 23 06:24:04 2009
@@ -314,15 +314,20 @@
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.publishFinish");
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#initialize(org.eclipse.core.runtime.IProgressMonitor)
-	 */
-	protected void initialize(IProgressMonitor monitor) {
+
+    /**
+     * Initializes the Geronimo server delegate. This method is called by the server core framework 
+     * to give delegates a chance to do their own initialization. As such, the GEP proper should 
+     * never call this method.
+     * 
+     * @param monitor a progress monitor, or <code>null</code> if progress reporting and cancellation 
+     * are not desired
+     */
+    protected void initialize(IProgressMonitor monitor) {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.initialize", monitor);
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.initialize");
-	}
+    }
+
 
 	/*
 	 * (non-Javadoc)
@@ -349,26 +354,32 @@
 		return (IGeronimoServer) getServer().loadAdapter(IGeronimoServer.class, null);
 	}
 
-	protected void terminate() {
+
+    protected void terminate() {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.terminate");
 
-		if (getServer().getServerState() == IServer.STATE_STOPPED)
-			return;
+        if (getServer().getServerState() == IServer.STATE_STOPPED)
+            return;
 
-		try {
-			setServerState(IServer.STATE_STOPPING);
-			Trace.trace(Trace.INFO, "Killing the geronimo server process"); //$NON-NLS-1$
-			if (process != null && !process.isTerminated()) {
-				process.terminate();
+        try {
+            setServerState(IServer.STATE_STOPPING);
+            Trace.trace(Trace.INFO, "Killing the geronimo server process"); //$NON-NLS-1$
+            if (process != null && !process.isTerminated()) {
+                process.terminate();
 
-			}
-			stopImpl();
-		} catch (Exception e) {
-			Trace.trace(Trace.SEVERE, "Error killing the geronimo server process", e); //$NON-NLS-1$
-		}
+            }
+            stopImpl();
+        } catch (Exception e) {
+            Trace.trace(Trace.SEVERE, "Error killing the geronimo server process", e); //$NON-NLS-1$
+            // 
+            // WTP does not allow a CoreException to be thrown in this case 
+            // 
+            throw new RuntimeException(Messages.STOP_FAIL);
+        }
 
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.terminate");
-	}
+    }
+
 
 	protected void stopImpl() {
 		if (process != null) {