JBoss Tools SVN: r41619 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-06-01 05:54:44 -0400 (Fri, 01 Jun 2012)
New Revision: 41619
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java
Log:
JBIDE-11831 TO TRUNK
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -27,6 +27,10 @@
private PollThread pollThread = null;
+ protected PollThread getPollThread() {
+ return pollThread;
+ }
+
public IServer getServer() {
return actualBehavior.getServer();
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -89,16 +89,7 @@
* but some pollers such as timeout poller
*/
protected IStatus isServerStarted(DelegatingServerBehavior jbsBehavior) {
- IServerStatePoller poller = PollThreadUtils.getPoller(IServerStatePoller.SERVER_UP, jbsBehavior.getServer());
-
- // Need to be able to FORCE the poller to poll immediately
- if( poller == null || !(poller instanceof IServerStatePoller2))
- poller = new WebPortPoller();
- IStatus started = ((IServerStatePoller2)poller).getCurrentStateSynchronous(jbsBehavior.getServer());
- // Trace
- Trace.trace(Trace.STRING_FINER, "Checking if a server is already started: " + started.getMessage()); //$NON-NLS-1$
-
- return started;
+ return PollThreadUtils.isServerStarted(jbsBehavior);
}
protected boolean handleAlreadyStartedScenario( DelegatingServerBehavior jbsBehavior, IStatus startedStatus) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -13,13 +13,18 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.Trace;
+import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.INeedCredentials;
import org.jboss.ide.eclipse.as.core.server.IPollResultListener;
import org.jboss.ide.eclipse.as.core.server.IProvideCredentials;
import org.jboss.ide.eclipse.as.core.server.IServerProvider;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller2;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
@@ -196,4 +201,23 @@
return returnedCredentials;
}
}
+
+ /*
+ * A solution needs to be found here.
+ * Should ideally use the poller that the server says is its poller,
+ * but some pollers such as timeout poller cannot actively check
+ */
+ public static IStatus isServerStarted(DelegatingServerBehavior jbsBehavior) {
+ IServerStatePoller poller = PollThreadUtils.getPoller(IServerStatePoller.SERVER_UP, jbsBehavior.getServer());
+
+ // Need to be able to FORCE the poller to poll immediately
+ if( poller == null || !(poller instanceof IServerStatePoller2))
+ poller = new WebPortPoller();
+ IStatus started = ((IServerStatePoller2)poller).getCurrentStateSynchronous(jbsBehavior.getServer());
+ // Trace
+ Trace.trace(Trace.STRING_FINER, "Checking if a server is already started: " + started.getMessage()); //$NON-NLS-1$
+
+ return started;
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -13,9 +13,11 @@
package org.jboss.ide.eclipse.as.rse.core;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
public abstract class AbstractRSEBehaviourDelegate extends AbstractJBossBehaviourDelegate {
@@ -26,16 +28,23 @@
@Override
public void stopImpl(boolean force) {
- if( force ) {
+ // If force, or if the server is already started (force a one-time synchronous poll)
+ if( force || !PollThreadUtils.isServerStarted(actualBehavior).isOK()) {
forceStop();
+ return;
}
setServerStopping();
- if (!gracefullStop().isOK()) {
+ IStatus shutdownStatus = gracefullStop();
+ if (!shutdownStatus.isOK()) {
+ // The shutdown failed. This indicates a bad command or nonfunctional shutdown command
+ if(getServer().getServerState() == IServer.STATE_STOPPED)
+ return; // The poller already changed state to stopped
+
+ if( getPollThread() != null )
+ getPollThread().cancel();
setServerStarted();
- } else {
- setServerStopped();
- }
+ } // else wait for the poller to set the proper state
}
@Override
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
@@ -45,8 +46,7 @@
@Override
protected IStatus gracefullStop() {
try {
- executeShutdownCommand(getShutdownCommand(getServer()));
- return Status.OK_STATUS;
+ return executeShutdownCommand(getShutdownCommand(getServer()));
} catch(CoreException ce) {
ServerLogger.getDefault().log(getServer(), ce.getStatus());
return new Status(
@@ -56,12 +56,19 @@
}
}
- private void executeShutdownCommand(String shutdownCommand) throws CoreException {
+ protected IStatus executeShutdownCommand(String shutdownCommand) throws CoreException {
ServerShellModel model = RSEHostShellModel.getInstance().getModel(getServer());
- model.executeRemoteCommand("/", shutdownCommand, new String[]{}, new NullProgressMonitor(), 10000, true);
- IHostShell shell = model.getStartupShell();
- if( RSEUtils.isActive(shell)) {
- shell.writeToShell("exit");
+ int ret = model.executeRemoteCommandGetStatus("/", shutdownCommand, new String[]{}, new NullProgressMonitor(), 10000, true);
+ if( ret == -1 || ret == 0 ) {
+ // either a shutdown success or a failure on the part of the tools to accurately discover the exit code
+ // proceed as normal
+ IHostShell shell = model.getStartupShell();
+ if( RSEUtils.isActive(shell)) {
+ shell.writeToShell("exit");
+ }
+ return Status.OK_STATUS;
}
+ return new Status(IStatus.ERROR, RSECorePlugin.PLUGIN_ID,
+ NLS.bind("Remote shutdown command failed with status {0}", ret));
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java 2012-06-01 09:54:15 UTC (rev 41618)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java 2012-06-01 09:54:44 UTC (rev 41619)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
@@ -32,6 +33,7 @@
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.Trace;
import org.jboss.ide.eclipse.as.core.server.IJBASHostShellListener;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
@@ -128,7 +130,8 @@
try {
if( singleUseShell == null || !singleUseShell.isActive()) {
singleUseShell = service.launchShell(initialWorkingDirectory, environment, monitor);
- } else {
+ } else if( initialWorkingDirectory != null ){
+ // allow for a null working directory to ensure no command is run here
singleUseShell.writeToShell("cd " + initialWorkingDirectory);
}
singleUseShell.writeToShell(command);
@@ -151,14 +154,72 @@
throws CoreException {
executeRemoteCommand(initialWorkingDirectory, command, environment, monitor);
ThreadUtils.sleepFor(delay);
- if( exit ) {
+ if( exit && singleUseShell != null) {
singleUseShell.exit();
singleUseShell = null;
}
}
-
+
+ /**
+ * Return a -1 if no idea what happened, or the actual status code from the shutdown command
+ *
+ * @param initialWorkingDirectory
+ * @param command
+ * @param environment
+ * @param monitor
+ * @param delay
+ * @param exit
+ * @return
+ * @throws CoreException
+ */
+ public int executeRemoteCommandGetStatus(
+ String initialWorkingDirectory, String command,
+ String[] environment, IProgressMonitor monitor,
+ int delay, boolean exit)
+ throws CoreException {
+ executeRemoteCommand(initialWorkingDirectory, command, environment, monitor);
+ final String[] statusLine = new String[2]; // [0] is last, [1] is new
+ final boolean[] done = new boolean[1];
+ done[0] = false;
+ statusLine[0] = null;
+ IHostShellOutputListener statusListener = new IHostShellOutputListener() {
+ public void shellOutputChanged(IHostShellChangeEvent event) {
+ IHostOutput[] lines = event.getLines();
+ for( int i = 0; i < lines.length; i++ ) {
+ // shift
+ if( !done[0]) {
+ statusLine[0] = statusLine[1];
+ statusLine[1] = lines[i].getString();
+ System.out.println(lines[i].getString());
+ }
+
+ if( serverId.equals(statusLine[1]))
+ // Then the real answer is the line before this one... statusLine[0]
+ done[0] = true;
+ }
+ }
+ };
+ singleUseShell.getStandardOutputReader().addOutputListener(statusListener);
+
+ singleUseShell.writeToShell("echo $? && echo " + serverId);
+ ThreadUtils.sleepFor(delay);
+ if( exit && singleUseShell != null && singleUseShell.isActive() ) {
+ singleUseShell.exit();
+ singleUseShell = null;
+ }
+ String s = statusLine[0];
+ if( s != null ) {
+ try {
+ Integer i = Integer.parseInt(s);
+ return i.intValue();
+ } catch(NumberFormatException nfe) {
+ }
+ }
+ Trace.trace(Trace.STRING_FINER, NLS.bind("Command {0} exited with status {1}", command, statusLine[0]));
+ return -1;
+ }
}
-
+
public static IShellService findShellService(DelegatingServerBehavior behaviour) throws CoreException {
return findShellService(behaviour.getServer());
}
12 years, 6 months
JBoss Tools SVN: r41618 - in branches/jbosstools-3.3.x/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-06-01 05:54:15 -0400 (Fri, 01 Jun 2012)
New Revision: 41618
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java
Log:
JBIDE-11831 to cr1
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -27,6 +27,10 @@
private PollThread pollThread = null;
+ protected PollThread getPollThread() {
+ return pollThread;
+ }
+
public IServer getServer() {
return actualBehavior.getServer();
}
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossStartLaunchConfiguration.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -89,16 +89,7 @@
* but some pollers such as timeout poller
*/
protected IStatus isServerStarted(DelegatingServerBehavior jbsBehavior) {
- IServerStatePoller poller = PollThreadUtils.getPoller(IServerStatePoller.SERVER_UP, jbsBehavior.getServer());
-
- // Need to be able to FORCE the poller to poll immediately
- if( poller == null || !(poller instanceof IServerStatePoller2))
- poller = new WebPortPoller();
- IStatus started = ((IServerStatePoller2)poller).getCurrentStateSynchronous(jbsBehavior.getServer());
- // Trace
- Trace.trace(Trace.STRING_FINER, "Checking if a server is already started: " + started.getMessage()); //$NON-NLS-1$
-
- return started;
+ return PollThreadUtils.isServerStarted(jbsBehavior);
}
protected boolean handleAlreadyStartedScenario( DelegatingServerBehavior jbsBehavior, IStatus startedStatus) {
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -13,13 +13,18 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.Trace;
+import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.INeedCredentials;
import org.jboss.ide.eclipse.as.core.server.IPollResultListener;
import org.jboss.ide.eclipse.as.core.server.IProvideCredentials;
import org.jboss.ide.eclipse.as.core.server.IServerProvider;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller2;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
@@ -196,4 +201,23 @@
return returnedCredentials;
}
}
+
+ /*
+ * A solution needs to be found here.
+ * Should ideally use the poller that the server says is its poller,
+ * but some pollers such as timeout poller cannot actively check
+ */
+ public static IStatus isServerStarted(DelegatingServerBehavior jbsBehavior) {
+ IServerStatePoller poller = PollThreadUtils.getPoller(IServerStatePoller.SERVER_UP, jbsBehavior.getServer());
+
+ // Need to be able to FORCE the poller to poll immediately
+ if( poller == null || !(poller instanceof IServerStatePoller2))
+ poller = new WebPortPoller();
+ IStatus started = ((IServerStatePoller2)poller).getCurrentStateSynchronous(jbsBehavior.getServer());
+ // Trace
+ Trace.trace(Trace.STRING_FINER, "Checking if a server is already started: " + started.getMessage()); //$NON-NLS-1$
+
+ return started;
+ }
+
}
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSEBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -13,9 +13,11 @@
package org.jboss.ide.eclipse.as.rse.core;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
public abstract class AbstractRSEBehaviourDelegate extends AbstractJBossBehaviourDelegate {
@@ -26,16 +28,23 @@
@Override
public void stopImpl(boolean force) {
- if( force ) {
+ // If force, or if the server is already started (force a one-time synchronous poll)
+ if( force || !PollThreadUtils.isServerStarted(actualBehavior).isOK()) {
forceStop();
+ return;
}
setServerStopping();
- if (!gracefullStop().isOK()) {
+ IStatus shutdownStatus = gracefullStop();
+ if (!shutdownStatus.isOK()) {
+ // The shutdown failed. This indicates a bad command or nonfunctional shutdown command
+ if(getServer().getServerState() == IServer.STATE_STOPPED)
+ return; // The poller already changed state to stopped
+
+ if( getPollThread() != null )
+ getPollThread().cancel();
setServerStarted();
- } else {
- setServerStopped();
- }
+ } // else wait for the poller to set the proper state
}
@Override
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
@@ -45,8 +46,7 @@
@Override
protected IStatus gracefullStop() {
try {
- executeShutdownCommand(getShutdownCommand(getServer()));
- return Status.OK_STATUS;
+ return executeShutdownCommand(getShutdownCommand(getServer()));
} catch(CoreException ce) {
ServerLogger.getDefault().log(getServer(), ce.getStatus());
return new Status(
@@ -56,12 +56,19 @@
}
}
- private void executeShutdownCommand(String shutdownCommand) throws CoreException {
+ protected IStatus executeShutdownCommand(String shutdownCommand) throws CoreException {
ServerShellModel model = RSEHostShellModel.getInstance().getModel(getServer());
- model.executeRemoteCommand("/", shutdownCommand, new String[]{}, new NullProgressMonitor(), 10000, true);
- IHostShell shell = model.getStartupShell();
- if( RSEUtils.isActive(shell)) {
- shell.writeToShell("exit");
+ int ret = model.executeRemoteCommandGetStatus("/", shutdownCommand, new String[]{}, new NullProgressMonitor(), 10000, true);
+ if( ret == -1 || ret == 0 ) {
+ // either a shutdown success or a failure on the part of the tools to accurately discover the exit code
+ // proceed as normal
+ IHostShell shell = model.getStartupShell();
+ if( RSEUtils.isActive(shell)) {
+ shell.writeToShell("exit");
+ }
+ return Status.OK_STATUS;
}
+ return new Status(IStatus.ERROR, RSECorePlugin.PLUGIN_ID,
+ NLS.bind("Remote shutdown command failed with status {0}", ret));
}
}
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java 2012-06-01 08:39:20 UTC (rev 41617)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEHostShellModel.java 2012-06-01 09:54:15 UTC (rev 41618)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
@@ -32,6 +33,7 @@
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.Trace;
import org.jboss.ide.eclipse.as.core.server.IJBASHostShellListener;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
@@ -128,7 +130,8 @@
try {
if( singleUseShell == null || !singleUseShell.isActive()) {
singleUseShell = service.launchShell(initialWorkingDirectory, environment, monitor);
- } else {
+ } else if( initialWorkingDirectory != null ){
+ // allow for a null working directory to ensure no command is run here
singleUseShell.writeToShell("cd " + initialWorkingDirectory);
}
singleUseShell.writeToShell(command);
@@ -151,14 +154,72 @@
throws CoreException {
executeRemoteCommand(initialWorkingDirectory, command, environment, monitor);
ThreadUtils.sleepFor(delay);
- if( exit ) {
+ if( exit && singleUseShell != null) {
singleUseShell.exit();
singleUseShell = null;
}
}
-
+
+ /**
+ * Return a -1 if no idea what happened, or the actual status code from the shutdown command
+ *
+ * @param initialWorkingDirectory
+ * @param command
+ * @param environment
+ * @param monitor
+ * @param delay
+ * @param exit
+ * @return
+ * @throws CoreException
+ */
+ public int executeRemoteCommandGetStatus(
+ String initialWorkingDirectory, String command,
+ String[] environment, IProgressMonitor monitor,
+ int delay, boolean exit)
+ throws CoreException {
+ executeRemoteCommand(initialWorkingDirectory, command, environment, monitor);
+ final String[] statusLine = new String[2]; // [0] is last, [1] is new
+ final boolean[] done = new boolean[1];
+ done[0] = false;
+ statusLine[0] = null;
+ IHostShellOutputListener statusListener = new IHostShellOutputListener() {
+ public void shellOutputChanged(IHostShellChangeEvent event) {
+ IHostOutput[] lines = event.getLines();
+ for( int i = 0; i < lines.length; i++ ) {
+ // shift
+ if( !done[0]) {
+ statusLine[0] = statusLine[1];
+ statusLine[1] = lines[i].getString();
+ System.out.println(lines[i].getString());
+ }
+
+ if( serverId.equals(statusLine[1]))
+ // Then the real answer is the line before this one... statusLine[0]
+ done[0] = true;
+ }
+ }
+ };
+ singleUseShell.getStandardOutputReader().addOutputListener(statusListener);
+
+ singleUseShell.writeToShell("echo $? && echo " + serverId);
+ ThreadUtils.sleepFor(delay);
+ if( exit && singleUseShell != null && singleUseShell.isActive() ) {
+ singleUseShell.exit();
+ singleUseShell = null;
+ }
+ String s = statusLine[0];
+ if( s != null ) {
+ try {
+ Integer i = Integer.parseInt(s);
+ return i.intValue();
+ } catch(NumberFormatException nfe) {
+ }
+ }
+ Trace.trace(Trace.STRING_FINER, NLS.bind("Command {0} exited with status {1}", command, statusLine[0]));
+ return -1;
+ }
}
-
+
public static IShellService findShellService(DelegatingServerBehavior behaviour) throws CoreException {
return findShellService(behaviour.getServer());
}
12 years, 6 months
JBoss Tools SVN: r41617 - trunk/forge/plugins/org.jboss.tools.forge.runtime.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-06-01 04:39:20 -0400 (Fri, 01 Jun 2012)
New Revision: 41617
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime/.classpath
Log:
fix warning
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime/.classpath
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime/.classpath 2012-06-01 08:38:06 UTC (rev 41616)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/.classpath 2012-06-01 08:39:20 UTC (rev 41617)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="forge-distribution-1.0.5.Final/modules/javax/inject/api/main/javax.inject-1.jar"/>
12 years, 6 months
JBoss Tools SVN: r41616 - trunk/forge/plugins/org.jboss.tools.forge.core.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-06-01 04:38:06 -0400 (Fri, 01 Jun 2012)
New Revision: 41616
Modified:
trunk/forge/plugins/org.jboss.tools.forge.core/build.properties
Log:
fix warning
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/build.properties 2012-06-01 08:37:44 UTC (rev 41615)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/build.properties 2012-06-01 08:38:06 UTC (rev 41616)
@@ -1,5 +1,5 @@
source.. = src/
-output.. = bin/
+output.. = target/classes/
bin.includes = META-INF/,\
.,\
plugin.xml,\
12 years, 6 months
JBoss Tools SVN: r41615 - trunk/forge/plugins/org.jboss.tools.forge.ui.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-06-01 04:37:44 -0400 (Fri, 01 Jun 2012)
New Revision: 41615
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/build.properties
Log:
fix warning
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/build.properties 2012-06-01 08:35:13 UTC (rev 41614)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/build.properties 2012-06-01 08:37:44 UTC (rev 41615)
@@ -1,4 +1,4 @@
-output.. = bin/
+output.. = target/classes/
bin.includes = META-INF/,\
plugin.xml,\
plugin.properties,\
12 years, 6 months
JBoss Tools SVN: r41614 - trunk/forge/plugins/org.jboss.tools.forge.runtime.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-06-01 04:35:13 -0400 (Fri, 01 Jun 2012)
New Revision: 41614
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime/build.properties
Log:
fix warnings
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime/build.properties 2012-06-01 08:12:55 UTC (rev 41613)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/build.properties 2012-06-01 08:35:13 UTC (rev 41614)
@@ -1,5 +1,6 @@
bin.includes = META-INF/,\
- forge-distribution-1.0.5.Final/
+ forge-distribution-1.0.5.Final/,\
+ plugin.properties
src.includes = *
jars.compile.order = .
-source.. =
+source.. = src
12 years, 6 months
JBoss Tools SVN: r41613 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-06-01 04:12:55 -0400 (Fri, 01 Jun 2012)
New Revision: 41613
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java
Log:
Fixed - JBIDE-11958
OpenShift wizard: fields are not in synch when importing app
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-06-01 07:59:31 UTC (rev 41612)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-06-01 08:12:55 UTC (rev 41613)
@@ -79,7 +79,7 @@
if(project != null && project.exists()) {
setRepositoryPath(project.getLocation().toOSString());
} else {
- setRepositoryPath("");
+ setRepositoryPath(IOpenShiftExpressWizardModel.DEFAULT_REPOSITORY_PATH);
}
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java 2012-06-01 07:59:31 UTC (rev 41612)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java 2012-06-01 08:12:55 UTC (rev 41613)
@@ -48,6 +48,9 @@
public void setNewProject(boolean newProject) {
firePropertyChange(PROPERTY_IS_NEW_PROJECT, wizardModel.isNewProject(), wizardModel.setNewProject(newProject));
+ if(wizardModel.isNewProject()) {
+ setProjectName(null);
+ }
validateExistingProject();
}
12 years, 6 months
JBoss Tools SVN: r41612 - branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-06-01 03:59:31 -0400 (Fri, 01 Jun 2012)
New Revision: 41612
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java
Log:
Fixed - JBIDE-11958
OpenShift wizard: fields are not in synch when importing app
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-06-01 05:54:34 UTC (rev 41611)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-06-01 07:59:31 UTC (rev 41612)
@@ -74,12 +74,12 @@
return new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if(!wizardModel.isNewProject() && isUseDefaultRepoPath()) {
+ if(isUseDefaultRepoPath()) {
final IProject project = wizardModel.getProject();
if(project != null && project.exists()) {
setRepositoryPath(project.getLocation().toOSString());
} else {
- setRepositoryPath("");
+ setRepositoryPath(IOpenShiftExpressWizardModel.DEFAULT_REPOSITORY_PATH);
}
}
}
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java 2012-06-01 05:54:34 UTC (rev 41611)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPageModel.java 2012-06-01 07:59:31 UTC (rev 41612)
@@ -48,6 +48,9 @@
public void setNewProject(boolean newProject) {
firePropertyChange(PROPERTY_IS_NEW_PROJECT, wizardModel.isNewProject(), wizardModel.setNewProject(newProject));
+ if(wizardModel.isNewProject()) {
+ setProjectName(null);
+ }
validateExistingProject();
}
12 years, 6 months
JBoss Tools SVN: r41611 - branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-06-01 01:54:34 -0400 (Fri, 01 Jun 2012)
New Revision: 41611
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
Log:
JBIDE-12040 remember password to cr1
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-06-01 05:52:02 UTC (rev 41610)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-06-01 05:54:34 UTC (rev 41611)
@@ -540,7 +540,7 @@
final CredentialsWizardPageModel model = new CredentialsWizardPageModel(inner);
model.setPassword(pass);
model.setRhLogin(user);
- model.setRememberPassword(false);
+ model.setRememberPassword(rememberPassword);
return new Runnable() {
public void run() {
final IStatus s = model.validateCredentials();
12 years, 6 months
JBoss Tools SVN: r41610 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-06-01 01:52:02 -0400 (Fri, 01 Jun 2012)
New Revision: 41610
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
Log:
JBIDE-12040
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-06-01 04:42:43 UTC (rev 41609)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-06-01 05:52:02 UTC (rev 41610)
@@ -540,7 +540,7 @@
final CredentialsWizardPageModel model = new CredentialsWizardPageModel(inner);
model.setPassword(pass);
model.setRhLogin(user);
- model.setRememberPassword(false);
+ model.setRememberPassword(rememberPassword);
return new Runnable() {
public void run() {
final IStatus s = model.validateCredentials();
12 years, 6 months