JBoss Tools SVN: r32610 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 09:17:27 -0400 (Tue, 05 Jul 2011)
New Revision: 32610
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java
Log:
[JBIDE-9215] corrected server home construction when building classpath
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java 2011-07-05 10:51:55 UTC (rev 32609)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java 2011-07-05 13:17:27 UTC (rev 32610)
@@ -66,7 +66,7 @@
protected List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath)
throws CoreException {
ArrayList<IRuntimeClasspathEntry> classpath = new ArrayList<IRuntimeClasspathEntry>();
- LaunchConfigUtils.addCPEntry(ServerUtil.getServerHomePath(server).toOSString(), IJBossRuntimeResourceConstants.SHUTDOWN_JAR_LOC, classpath);
+ LaunchConfigUtils.addCPEntry(ServerUtil.getServerHomePath(server), IJBossRuntimeResourceConstants.SHUTDOWN_JAR_LOC, classpath);
LaunchConfigUtils.addJREEntry(runtime.getVM(), classpath);
return LaunchConfigUtils.toStrings(classpath);
}
13 years, 6 months
JBoss Tools SVN: r32609 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 06:51:55 -0400 (Tue, 05 Jul 2011)
New Revision: 32609
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
Log:
[JBIDE-9215] corrected deprecation comment (where was it moved to)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-07-05 10:51:08 UTC (rev 32608)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-07-05 10:51:55 UTC (rev 32609)
@@ -105,7 +105,7 @@
}
/**
- * moved to {@link LocalJBossBehaviorDelegate#getDefaultStopArguments()}
+ * moved to {@link AbstractJBossBehaviourDelegate#getDefaultStopArguments()}
*/
@Deprecated
public static String getDefaultArgs(JBossServer jbs) {
13 years, 6 months
JBoss Tools SVN: r32608 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 06:51:08 -0400 (Tue, 05 Jul 2011)
New Revision: 32608
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
Log:
[JBIDE-9215] corrected deprecation comment (where was it moved to)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-07-05 10:29:29 UTC (rev 32607)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-07-05 10:51:08 UTC (rev 32608)
@@ -105,7 +105,7 @@
}
/**
- * moved to {@link JBossServerBehavior#getDefaultStopArguments()}
+ * moved to {@link LocalJBossBehaviorDelegate#getDefaultStopArguments()}
*/
@Deprecated
public static String getDefaultArgs(JBossServer jbs) {
13 years, 6 months
JBoss Tools SVN: r32607 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: server/internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 06:29:29 -0400 (Tue, 05 Jul 2011)
New Revision: 32607
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
Log:
[JBIDe-9054] internationalized error message
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2011-07-05 10:25:42 UTC (rev 32606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2011-07-05 10:29:29 UTC (rev 32607)
@@ -80,6 +80,7 @@
public static String CouldNotFindServer;
public static String ServerRuntimeNotFound;
public static String ServerRuntimeConfigNotFound;
+ public static String ServerHasNoRuntime;
public static String ServerNotFound;
public static String CannotLoadServerPoller;
public static String AddingJMXDeploymentFailed;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-07-05 10:25:42 UTC (rev 32606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-07-05 10:29:29 UTC (rev 32607)
@@ -60,6 +60,7 @@
CouldNotFindServer=Could not find jboss server with id {0}
ServerRuntimeNotFound=Runtime for server {0} cannot be found.
ServerRuntimeConfigNotFound=Configuration for runtime {0} is not set.
+ServerHasNoRuntime=Server {0} does not have a valid runtime environment
ServerNotFound=Server {0} not found.
CannotLoadServerPoller=Error instantiating Server Poller {0}
CannotSaveServersStartArgs=Could not save server start arguments for server {0}.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 10:25:42 UTC (rev 32606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 10:29:29 UTC (rev 32607)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal;
+import java.text.MessageFormat;
+
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
@@ -26,7 +28,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.ExtensionManager.IServerJMXRunnable;
@@ -36,7 +37,6 @@
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
import org.jboss.ide.eclipse.as.core.extensions.polling.ProcessTerminatedPoller.IProcessProvider;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.LocalStopLaunchConfigurator;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
@@ -354,6 +354,6 @@
// ignore
}
return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- "This server does not have a valid runtime environment"); //$NON-NLS-1$
+ MessageFormat.format(Messages.ServerHasNoRuntime, getServer().getName()));
}
}
13 years, 6 months
JBoss Tools SVN: r32606 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 06:25:42 -0400 (Tue, 05 Jul 2011)
New Revision: 32606
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
Log:
[JBIDe-9045] removed private method #getRuntime, replaced by RuntimeUtils#getJBossServerRuntime (this is a private method, no deprecation needed)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 10:25:28 UTC (rev 32605)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 10:25:42 UTC (rev 32606)
@@ -356,16 +356,4 @@
return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"This server does not have a valid runtime environment"); //$NON-NLS-1$
}
-
- @Deprecated
- private IJBossServerRuntime getRuntime() {
- IRuntime r = getServer().getRuntime();
- IJBossServerRuntime ajbsrt = null;
- if (r != null) {
- ajbsrt = (IJBossServerRuntime) r
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- }
- return ajbsrt;
- }
}
13 years, 6 months
JBoss Tools SVN: r32605 - trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/process.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-07-05 06:25:28 -0400 (Tue, 05 Jul 2011)
New Revision: 32605
Modified:
trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/process/ForgeLaunchHelperTest.java
Log:
Simplification of ForgeLaunchHelperTest
Modified: trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/process/ForgeLaunchHelperTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/process/ForgeLaunchHelperTest.java 2011-07-05 10:25:03 UTC (rev 32604)
+++ trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/process/ForgeLaunchHelperTest.java 2011-07-05 10:25:28 UTC (rev 32605)
@@ -1,66 +1,37 @@
package org.jboss.tools.forge.core.process;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
-import java.io.IOException;
-
import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.ui.progress.UIJob;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ForgeLaunchHelperTest {
- private static String TEST_LOCATION;
-
+ private String testLocation = null;
private IProcess forgeProcess = null;
- static {
- try {
- TEST_LOCATION = FileLocator.getBundleFile(Platform.getBundle("org.jboss.tools.forge.runtime")).getAbsolutePath();
- } catch (IOException e) {
- TEST_LOCATION = null;
- }
- }
-
@Before
public void setUp() throws Exception {
- forgeProcess = null;
+ testLocation = FileLocator.getBundleFile(Platform.getBundle("org.jboss.tools.forge.runtime")).getAbsolutePath();
}
@After
public void tearDown() throws Exception {
- if (forgeProcess != null) {
- try {
- forgeProcess.terminate();
- } catch (DebugException e) {}
- }
+ forgeProcess.terminate();
forgeProcess = null;
+ testLocation = null;
}
@Test
public void test() {
- new UIJob("testLaunch") {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- try {
- forgeProcess = ForgeLaunchHelper.launch("test", TEST_LOCATION);
- assertNotNull(forgeProcess);
- assertFalse(forgeProcess.isTerminated());
- } catch (RuntimeException e) {
- fail();
- }
- return null;
- }
-
- }.schedule();
+ forgeProcess = ForgeLaunchHelper.launch("test", testLocation);
+ assertNotNull(forgeProcess);
+ assertFalse(forgeProcess.isTerminated());
}
}
13 years, 6 months
JBoss Tools SVN: r32604 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 06:25:03 -0400 (Tue, 05 Jul 2011)
New Revision: 32604
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
Log:
[JBIDe-9045] deprecated private method #getRuntime, replaced by RuntimeUtils#getJBossServerRuntime
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:58:21 UTC (rev 32603)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 10:25:03 UTC (rev 32604)
@@ -42,6 +42,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
+import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
/**
*
@@ -344,13 +345,19 @@
}
public IStatus canChangeState(String launchMode) {
- if( getServer() != null && getServer().getRuntime() != null &&
- getRuntime().getVM() != null )
+ try {
+ if( getServer() != null
+ && getServer().getRuntime() != null
+ && RuntimeUtils.checkedGetJBossServerRuntime(getServer()).getVM() != null )
return Status.OK_STATUS;
+ } catch(Exception e) {
+ // ignore
+ }
return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"This server does not have a valid runtime environment"); //$NON-NLS-1$
}
+ @Deprecated
private IJBossServerRuntime getRuntime() {
IRuntime r = getServer().getRuntime();
IJBossServerRuntime ajbsrt = null;
13 years, 6 months
JBoss Tools SVN: r32603 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 05:58:21 -0400 (Tue, 05 Jul 2011)
New Revision: 32603
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
Log:
[JBIDE-9215] unified duplicate calls to pollThread.cancel() into single method
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:56:38 UTC (rev 32602)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:58:21 UTC (rev 32603)
@@ -179,7 +179,7 @@
for (int i = 0; i < size; i++) {
if (process != null && process.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
DebugPlugin.getDefault().removeDebugEventListener(this);
- cancelPolling(null);
+ stopPolling();
forceStop();
addProcessTerminatedEvent();
}
13 years, 6 months
JBoss Tools SVN: r32602 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 05:56:38 -0400 (Tue, 05 Jul 2011)
New Revision: 32602
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
Log:
[JBIDE-9215] unified duplicate calls to pollThread.cancel() into single method
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:38:10 UTC (rev 32601)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:56:38 UTC (rev 32602)
@@ -74,7 +74,7 @@
// if we're starting up or shutting down and they've tried again,
// then force it to stop.
if( state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING ) {
- cancelPolling(null);
+ stopPolling();
forceStop();
return;
}
@@ -211,24 +211,21 @@
protected void pollServer(final boolean expectedState) {
IServerStatePoller poller = PollThreadUtils.getPoller(expectedState, getServer());
- pollServer(expectedState, poller);
+ PollThreadUtils.pollServer(expectedState, poller , pollThread, getActualBehavior());
}
protected void pollServer(boolean expectedState, IServerStatePoller poller) {
- cancelPolling(null);
- this.pollThread = new PollThread(expectedState, poller, getActualBehavior());
- pollThread.start();
+ this.pollThread = PollThreadUtils.pollServer(expectedState, poller, pollThread, getActualBehavior());
}
+ protected void stopPolling() {
+ cancelPolling(null);
+ }
+
protected void cancelPolling(String message) {
- if (pollThread != null) {
- if (message != null) {
- pollThread.cancel(message);
- } else {
- pollThread.cancel();
- }
- }
+ PollThreadUtils.cancelPolling(message, this.pollThread);
+ this.pollThread = null;
}
public void publishStart(final IProgressMonitor monitor) throws CoreException {
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 2011-07-05 09:38:10 UTC (rev 32601)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2011-07-05 09:56:38 UTC (rev 32602)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.util;
import org.eclipse.wst.server.core.IServer;
@@ -4,9 +14,15 @@
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
+/**
+ * @author Rob Stryker
+ * @author André Dietisheim
+ */
public class PollThreadUtils {
public static String getPollerId(boolean expectedState, IServer server) {
@@ -35,4 +51,32 @@
}
return null;
}
+
+ public static void stopPolling(PollThread pollThread) {
+ cancelPolling(null, pollThread);
+ }
+
+ public static void cancelPolling(String message, PollThread pollThread) {
+ if (pollThread != null) {
+ if (message != null) {
+ pollThread.cancel(message);
+ } else {
+ pollThread.cancel();
+ }
+ }
+ }
+
+ protected void pollServer(final boolean expectedState, PollThread pollThread, JBossServerBehavior behaviour, IServer server) {
+ IServerStatePoller poller = PollThreadUtils.getPoller(expectedState, server);
+ pollServer(expectedState, poller, pollThread, behaviour);
+ }
+
+
+ public static PollThread pollServer(boolean expectedState, IServerStatePoller poller, PollThread pollThread, JBossServerBehavior behaviour) {
+ stopPolling(pollThread);
+ PollThread newPollThread = new PollThread(expectedState, poller, behaviour);
+ newPollThread.start();
+ return newPollThread;
+ }
+
}
13 years, 6 months
JBoss Tools SVN: r32601 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-05 05:38:10 -0400 (Tue, 05 Jul 2011)
New Revision: 32601
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
Log:
[JBIDE-9215] unified duplicate calls to pollThread.cancel() into single method
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:18:38 UTC (rev 32600)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-07-05 09:38:10 UTC (rev 32601)
@@ -74,7 +74,7 @@
// if we're starting up or shutting down and they've tried again,
// then force it to stop.
if( state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING ) {
- pollThread.cancel();
+ cancelPolling(null);
forceStop();
return;
}
13 years, 6 months