1
/***************************************
3
* JBoss: The OpenSource J2EE WebOS *
5
* Distributable under LGPL license. *
6
* See terms of license at gnu.org. *
8
***************************************/
9
package org.jboss.test.remoting.performance.spring.rmi;
11
import org.jboss.remoting.callback.Callback;
12
import org.jboss.remoting.callback.HandleCallbackException;
13
import org.jboss.remoting.callback.InvokerCallbackHandler;
14
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
17
* @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
19
public class SpringRMIHandler implements InvokerCallbackHandler
21
private SpringRMICallbackServer springRMICallbackServer;
22
private String sessionId;
24
public SpringRMIHandler(String sessionId)
26
this.sessionId = sessionId;
31
// Resource res = new ClassPathResource("SpringRMICallbackServerService.xml", SpringRMIHandler.class);
32
// BeanFactory factory = new XmlBeanFactory(res);
33
// springRMICallbackServer = (SpringRMICallbackServer)factory.getBean("springRMICallbackServerService:" );
37
Instead of creating callback server proxies by injection, the following xml declaration is
38
replaced by programmatic creation. Each callback server is registered under a name
39
ending in the sessionId.
41
<bean id="springRMICallbackServerService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
42
<property name="serviceUrl" value="rmi://localhost:1299/SpringRMICallbackServerService"/>
43
<property name="serviceInterface" value="org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer"/>
47
RmiProxyFactoryBean factory = new RmiProxyFactoryBean();
48
factory.setServiceUrl("rmi://localhost:1299/SpringRMICallbackServerService:" + sessionId);
49
factory.setServiceInterface(org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer.class);
52
factory.afterPropertiesSet();
56
System.out.println("unable to create callback proxy");
57
System.out.println(e);
59
springRMICallbackServer = (SpringRMICallbackServer)factory.getObject();
62
public SpringRMICallbackServer getSpringRMICallbackServer()
64
return springRMICallbackServer;
67
public void setSpringRMICallbackServer(SpringRMICallbackServer springRMICallbackServer)
69
this.springRMICallbackServer = springRMICallbackServer;
72
public void handleCallback(Callback callback) throws HandleCallbackException
74
System.out.println("Need to make call on SpringRMICallbackServer with results. " + callback);
78
springRMICallbackServer.finishedProcessing(callback);
83
throw new HandleCallbackException(e.getMessage());
b'\\ No newline at end of file'