[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/shutdown ...
Ron Sigal
ron_sigal at yahoo.com
Fri Jun 8 02:09:23 EDT 2007
User: rsigal
Date: 07/06/08 02:09:23
Modified: src/tests/org/jboss/test/remoting/shutdown Tag:
remoting_2_x AbstractClient.java
Log:
JBREM-641: Added a blocking mode CallbackPoller.
Revision Changes Path
No revision
No revision
1.1.2.3 +22 -11 JBossRemoting/src/tests/org/jboss/test/remoting/shutdown/AbstractClient.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractClient.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/shutdown/AbstractClient.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- AbstractClient.java 22 Jan 2007 06:41:09 -0000 1.1.2.2
+++ AbstractClient.java 8 Jun 2007 06:09:23 -0000 1.1.2.3
@@ -29,6 +29,7 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.CallbackPoller;
import org.jboss.remoting.callback.HandleCallbackException;
@@ -36,7 +37,7 @@
/**
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1.2.2 $
+ * @version $Revision: 1.1.2.3 $
* <p>
* Copyright Jan 19, 2007
* </p>
@@ -60,7 +61,8 @@
/**
* This test is used to verify that a JVM with a client connected to a server will shut
* down. To exercise as many threads as possible, it enables leasing, registers a
- * connection listener, and registers a callback handler for polled callbacks.
+ * connection listener, and registers a callback handler for blocking polled callbacks
+ * and another callback handler for nonblocking polled callbacks.
*
* At the end of the method, it creates a Thread which runs longer that this test is
* supposed to last. According to the value returned by the overridden abstract
@@ -84,21 +86,30 @@
if (18 != i.intValue())
throw new Exception("invocation failed");
System.out.println("invocation successful");
- TestCallbackHandler callbackHandler = new TestCallbackHandler();
- System.out.println("added connection listener");
- System.out.println("adding listener");
+ TestCallbackHandler callbackHandler1 = new TestCallbackHandler();
HashMap metadata = new HashMap();
+ metadata.put(ServerInvoker.BLOCKING_TIMEOUT, "2000");
+ client.addListener(callbackHandler1, metadata, null, false);
+ System.out.println("added blocking listener 1");
+ TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
metadata.put(CallbackPoller.CALLBACK_POLL_PERIOD, "500");
- client.addListener(callbackHandler, metadata, null, false);
- System.out.println("added listener");
+ metadata.put(ServerInvoker.BLOCKING_MODE, ServerInvoker.NONBLOCKING);
+ client.addListener(callbackHandler2, metadata, null, false);
+ System.out.println("added nonblocking listener 2");
Thread.sleep(1000);
- if (!callbackHandler.receivedCallback)
+ if (!callbackHandler1.receivedCallback)
{
- System.out.println("callback failed");
- throw new Exception("callback failed");
+ System.out.println("callback 1 failed");
+ throw new Exception("callback 1 failed");
+ }
+ if (!callbackHandler2.receivedCallback)
+ {
+ System.out.println("callback 2 failed");
+ throw new Exception("callback 2 failed");
}
System.out.println("callback successful");
- client.removeListener(callbackHandler);
+ client.removeListener(callbackHandler1);
+ client.removeListener(callbackHandler2);
client.disconnect();
Thread t = new Thread()
{
More information about the jboss-cvs-commits
mailing list