geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r475436 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/ org.apache.geronimo.st.v11.core/src/org/apache/ger...
Date Wed, 15 Nov 2006 21:29:29 GMT
Author: sppatel
Date: Wed Nov 15 13:29:28 2006
New Revision: 475436

URL: http://svn.apache.org/viewvc?view=rev&rev=475436
Log:
simplify stop methods, synchronize stop and setupLaunch methods to fix server recycle issues

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/PingThread.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/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/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?view=diff&rev=475436&r1=475435&r2=475436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Wed Nov 15 13:29:28 2006
@@ -138,8 +138,8 @@
 	 * @param monitor
 	 * @throws CoreException
 	 */
-	protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor)
throws CoreException {
-		Trace.trace(Trace.INFO, "--> GeronimoServerBehavior.setupLaunch()");
+	synchronized protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor
monitor) throws CoreException {
+		Trace.trace(Trace.INFO, "--> GeronimoServerBehaviorDelegate.setupLaunch()");
 
 		if (!SocketUtil.isLocalhost(getServer().getHost()))
 			return;
@@ -170,7 +170,7 @@
 		};
 
 		getServer().addServerListener(listener);
-		Trace.trace(Trace.INFO, "<-- GeronimoServerBehavior.setupLaunch()");
+		Trace.trace(Trace.INFO, "<-- GeronimoServerBehaviorDelegate.setupLaunch()");
 	}
 
 	/*
@@ -178,7 +178,14 @@
 	 * 
 	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
 	 */
-	public void stop(boolean force) {
+	synchronized public void stop(boolean force) {
+		Trace.trace(Trace.INFO, "--> stop()");
+		stopPingThread();
+		if (getServer().getServerState() != IServer.STATE_STOPPED) {
+			setServerState(IServer.STATE_STOPPING);
+			stopKernel();
+		}
+		GeronimoConnectionFactory.getInstance().destroy(getServer());
 		if (force) {
 			terminate();
 			return;
@@ -188,6 +195,7 @@
 			return;
 		if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING)
 			terminate();
+		Trace.trace(Trace.INFO, "<-- stop()");
 	}
 	
 	/* 
@@ -327,6 +335,7 @@
 	}
 
 	protected void terminate() {
+		Trace.trace(Trace.INFO,"terminate()");
 		if (getServer().getServerState() == IServer.STATE_STOPPED)
 			return;
 
@@ -344,10 +353,6 @@
 	}
 
 	protected void stopImpl() {
-		if (pingThread != null) {
-			pingThread.interrupt();
-			pingThread = null;
-		}
 		if (process != null) {
 			process = null;
 			DebugPlugin.getDefault().removeDebugEventListener(processListener);
@@ -692,20 +697,29 @@
 	}
 
 	protected void startPingThread() {
+		Trace.trace(Trace.INFO, "startPingThread()");
 		pingThread = new PingThread(this, getServer());
 		pingThread.start();
 	}
+	
+	protected void stopPingThread() {
+		Trace.trace(Trace.INFO, "stopPingThread()");
+		if (pingThread != null) {
+			pingThread.interrupt();
+			pingThread = null;
+		}
+	}
+	
+	protected abstract void stopKernel();
 
 	protected void startUpdateServerStateTask() {
-		Trace.trace(Trace.INFO, "startUpdateServerStateTask() "
-				+ getServer().getName());
+		Trace.trace(Trace.INFO, "startUpdateServerStateTask() " + getServer().getName());
 		timer = new Timer(true);
 		timer.schedule(new UpdateServerStateTask(this, getServer()), 10000, TIMER_TASK_INTERVAL
* 1000);
 	}
 
 	protected void stopUpdateServerStateTask() {
-		Trace.trace(Trace.INFO, "stopUpdateServerStateTask() "
-				+ getServer().getName());
+		Trace.trace(Trace.INFO, "stopUpdateServerStateTask() " + getServer().getName());
 		if (timer != null)
 			timer.cancel();
 	}

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/PingThread.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/PingThread.java?view=diff&rev=475436&r1=475435&r2=475436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/PingThread.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/PingThread.java
Wed Nov 15 13:29:28 2006
@@ -64,8 +64,9 @@
 
 		for (int tries = maxPings; tries > 0; tries--) {
 			
-			if(server.getServerState() == IServer.STATE_STOPPED) 
-				interrupt();
+			if(server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING)
{
+				return;
+			}
 
 			ClassLoader old = Thread.currentThread().getContextClassLoader();
 			try {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java?view=diff&rev=475436&r1=475435&r2=475436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
Wed Nov 15 13:29:28 2006
@@ -53,29 +53,14 @@
 		super();
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#stopKernel()
 	 */
-	public synchronized void stop(boolean force) {
-
-		Trace.trace(Trace.INFO, "--> stop()");
-
-		if (getServer().getServerState() != IServer.STATE_STOPPED) {
-			setServerState(IServer.STATE_STOPPING);
-			if (kernel != null) {
-				kernel.shutdown();
-			}
+	protected void stopKernel() {
+		if (kernel != null) {
+			kernel.shutdown();
+			kernel = null;
 		}
-
-		GeronimoConnectionFactory.getInstance().destroy(getServer());
-		kernel = null;
-
-		// kill the process
-		super.stop(true);
-
-		Trace.trace(Trace.INFO, "<-- stop()");
 	}
 
 	/**

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java?view=diff&rev=475436&r1=475435&r2=475436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
Wed Nov 15 13:29:28 2006
@@ -53,30 +53,15 @@
 	public GeronimoServerBehaviour() {
 		super();
 	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#stopKernel()
 	 */
-	public synchronized void stop(boolean force) {
-
-		Trace.trace(Trace.INFO, "--> stop()");
-
-		if (getServer().getServerState() != IServer.STATE_STOPPED) {
-			setServerState(IServer.STATE_STOPPING);
-			if (kernel != null) {
-				kernel.shutdown();
-			}
+	protected void stopKernel() {
+		if (kernel != null) {
+			kernel.shutdown();
+			kernel = null;
 		}
-
-		GeronimoConnectionFactory.getInstance().destroy(getServer());
-		kernel = null;
-
-		// kill the process
-		super.stop(true);
-
-		Trace.trace(Trace.INFO, "<-- stop()");
 	}
 
 	/**



Mime
View raw message