Author: rob.stryker(a)jboss.com
Date: 2007-07-20 13:14:03 -0400 (Fri, 20 Jul 2007)
New Revision: 2565
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerStatePoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java
Log:
fix me was remaining in TwiddlePoller.
Interface addition to allow for more customized polling preferences.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerStatePoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerStatePoller.java 2007-07-20
15:48:56 UTC (rev 2564)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerStatePoller.java 2007-07-20
17:14:03 UTC (rev 2565)
@@ -39,6 +39,9 @@
public void cancel(int type); // cancel the polling
public void cleanup(); // clean up any resources / processes. Will ALWAYS be called
+ public boolean supportsStartup();
+ public boolean supportsShutdown();
+
public class PollingException extends Exception {
public PollingException(String message) {super(message);}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java 2007-07-20
15:48:56 UTC (rev 2564)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java 2007-07-20
17:14:03 UTC (rev 2565)
@@ -24,24 +24,27 @@
import java.util.Date;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.ServerType;
import org.jboss.ide.eclipse.as.core.runtime.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.server.attributes.IServerPollingAttributes;
// Wait 15 seconds, then say it's at it's expected state
public class TimeoutPoller implements IServerStatePoller {
private boolean expectedState;
private long endTime;
+ private IServer server;
int timeout = -1;
public void beginPolling(IServer server, boolean expectedState, PollThread pt) {
this.expectedState = expectedState;
- this.endTime = new Date().getTime() + getTimeout();
+ this.server = server;
+ this.endTime = new Date().getTime() + getTimeout() - 2000;
}
- protected int getTimeout() {
- return 15000;
- }
public void cancel(int type) {
}
@@ -57,4 +60,28 @@
public void cleanup() {
}
+
+ public int getTimeout() {
+ int timeout;
+ JBossServer jbs = ((JBossServer)server.loadAdapter(JBossServer.class, null));
+ ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
+ if( expectedState == IServerStatePoller.SERVER_UP) {
+ int def = ((ServerType)server.getServerType()).getStartTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.START_TIMEOUT, def);
+ } else {
+ int def = ((ServerType)server.getServerType()).getStopTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.STOP_TIMEOUT, def);
+ }
+ return timeout;
+ }
+
+ public boolean supportsShutdown() {
+ return true;
+ }
+
+ public boolean supportsStartup() {
+ return true;
+ }
+
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java 2007-07-20
15:48:56 UTC (rev 2564)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java 2007-07-20
17:14:03 UTC (rev 2565)
@@ -85,11 +85,7 @@
ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
ClassLoader twiddleLoader = getClassLoader();
if( twiddleLoader != null ) {
- // TODO: FIX ME
-// String serverConfDir =
ServerConverter.getJBossServer(server).getConfigDirectory(false);
-// ServerDescriptorModel descriptorModel =
DescriptorModel.getDefault().getServerModel(new Path(serverConfDir));
-// int port = descriptorModel.getJNDIPort();
- int port = 1099;
+ int port = ServerConverter.getJBossServer(server).getJNDIPort();
Thread.currentThread().setContextClassLoader(twiddleLoader);
Properties props = new Properties();
@@ -235,6 +231,14 @@
setProperty(DATE, new Long(new Date().getTime()));
}
}
+
+ public boolean supportsShutdown() {
+ return true;
+ }
+
+ public boolean supportsStartup() {
+ return true;
+ }
Show replies by date