[jboss-cvs] JBoss Messaging SVN: r1861 - in trunk/tests/src/org/jboss/test/messaging/tools: . jmx/rmi
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 27 16:07:42 EST 2006
Author: clebert.suconic at jboss.com
Date: 2006-12-27 16:07:40 -0500 (Wed, 27 Dec 2006)
New Revision: 1861
Modified:
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
Adding method to kill a server and wait until the Kill Thread is finished.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-12-27 18:12:50 UTC (rev 1860)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-12-27 21:07:40 UTC (rev 1861)
@@ -260,6 +260,31 @@
}
}
+ /**
+ * Kills the server and wait keep trying any dumb communication until the server is effectively killed.
+ * We had to implement this method as kill will actually schedule a thread that will perform System.exit
+ * after few milliseconds.
+ * We will use this method in places where we need the server killed.
+ * */
+ public static synchronized void killAndWait(int i) throws Exception
+ {
+ Server server = servers[i].getServer();
+ kill(i);
+ try
+ {
+ while(true)
+ {
+ server.ping();
+ log.info("Server still alive... pinging again");
+ Thread.sleep(10);
+ }
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+
/**
* This method make sure that all servers that have been implicitely spawned when as a side
* effect of create() and/or start() are killed. The method is important because a forked
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-12-27 18:12:50 UTC (rev 1860)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-12-27 21:07:40 UTC (rev 1861)
@@ -177,6 +177,12 @@
return true;
}
+
+ public void ping() throws Exception
+ {
+ // noop... do nothing
+ }
+
public synchronized void kill() throws Exception
{
throw new IllegalStateException("Cannot KILL a local server. Consider using stop() instead.");
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-12-27 18:12:50 UTC (rev 1860)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-12-27 21:07:40 UTC (rev 1861)
@@ -157,6 +157,12 @@
new Thread(new VMKiller(), "VM Killer").start();
}
+
+ public void ping() throws Exception
+ {
+ //noop - nothing to be done
+ }
+
public ObjectName deploy(String mbeanConfiguration) throws Exception
{
return server.deploy(mbeanConfiguration);
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-12-27 18:12:50 UTC (rev 1860)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-12-27 21:07:40 UTC (rev 1861)
@@ -62,6 +62,14 @@
void kill() throws Exception;
/**
+ * When kill is called you are actually schedulling the server to be killed in few milliseconds.
+ * There are certain cases where we need to assure the server was really killed.
+ * For that we have this dumb operation where we can verify if the server still alive or not.
+ * @throws Exception
+ */
+ void ping() throws Exception;
+
+ /**
* Deploys and registers a service based on the MBean service descriptor element, specified as
* a String. Supports XMBeans. The implementing class and the ObjectName are inferred from the
* mbean element. If there are configuration attributed specified in the deployment descriptor,
More information about the jboss-cvs-commits
mailing list