1
package org.jboss.test.remoting.transport.rmi.timeout;
3
import javax.management.MBeanServer;
4
import org.jboss.jrunit.extensions.ServerTestCase;
5
import org.jboss.remoting.transport.Connector;
6
import org.jboss.remoting.InvokerLocator;
7
import org.jboss.remoting.ServerInvocationHandler;
8
import org.jboss.remoting.ServerInvoker;
9
import org.jboss.remoting.InvocationRequest;
10
import org.jboss.remoting.callback.InvokerCallbackHandler;
13
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
15
public class TimeoutServerTest extends ServerTestCase
17
private String locatorURI = "rmi://localhost:8899/?timeout=3000";
18
private Connector connector = null;
20
public void setUp() throws Exception
22
connector = new Connector();
23
InvokerLocator locator = new InvokerLocator(locatorURI);
24
connector.setInvokerLocator(locator.getLocatorURI());
26
connector.addInvocationHandler("test", new org.jboss.test.remoting.transport.rmi.timeout.TimeoutServerTest.TimeoutHandler());
30
protected void tearDown() throws Exception
39
public static void main(String[] args)
41
org.jboss.test.remoting.transport.rmi.timeout.TimeoutServerTest server = new org.jboss.test.remoting.transport.rmi.timeout.TimeoutServerTest();
52
private class TimeoutHandler implements ServerInvocationHandler
56
* set the mbean server that the handler can reference
60
public void setMBeanServer(MBeanServer server)
62
//TODO: -TME Implement
66
* set the invoker that owns this handler
70
public void setInvoker(ServerInvoker invoker)
72
//TODO: -TME Implement
76
* called to handle a specific invocation. Please take care to make sure
77
* implementations are thread safe and can, and often will, receive concurrent
78
* calls on this method.
84
public Object invoke(InvocationRequest invocation) throws Throwable
86
Object obj = invocation.getParameter();
87
if(obj instanceof String && "timeout".equals(obj))
89
Thread.currentThread().sleep(30000);
91
return null; //TODO: -TME Implement
95
* Adds a callback handler that will listen for callbacks from
96
* the server invoker handler.
98
* @param callbackHandler
100
public void addListener(InvokerCallbackHandler callbackHandler)
102
//TODO: -TME Implement
106
* Removes the callback handler that was listening for callbacks
107
* from the server invoker handler.
109
* @param callbackHandler
111
public void removeListener(InvokerCallbackHandler callbackHandler)
113
//TODO: -TME Implement