[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/hessian/web ...
Tom Elrod
tom.elrod at jboss.com
Sun Aug 13 15:30:05 EDT 2006
User: telrod
Date: 06/08/13 15:30:05
Added: src/tests/org/jboss/test/remoting/performance/spring/hessian/web
SpringHessianCallbackServerService.xml
SpringHessianHandler.java SpringHessianServer.java
SpringHessianServerImpl.java
Log:
JBREM-578 - including spring remoting tests (rmi and hessian transports) to the performance benchmark testing.
Revision Changes Path
1.1 date: 2006/08/13 19:30:05; author: telrod; state: Exp;JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/hessian/web/SpringHessianCallbackServerService.xml
Index: SpringHessianCallbackServerService.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean class="org.jboss.test.remoting.performance.spring.hessian.web.SpringHessianHandler">
<property name="springHessianCallbackServerService" ref="springHessianCallbackServerService"/>
</bean>
<bean id="springHessianCallbackServerService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:1299/SpringHessianCallbackServerService"/>
<property name="serviceInterface" value="org.jboss.test.remoting.performance.spring.hessian.client.SpringHessianCallbackServer"/>
</bean>
</beans>
1.1 date: 2006/08/13 19:30:05; author: telrod; state: Exp;JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/hessian/web/SpringHessianHandler.java
Index: SpringHessianHandler.java
===================================================================
/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.test.remoting.performance.spring.hessian.web;
import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.HandleCallbackException;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.test.remoting.performance.spring.hessian.client.SpringHessianCallbackServer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
/**
* @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
*/
public class SpringHessianHandler implements InvokerCallbackHandler
{
private SpringHessianCallbackServer springHessianCallbackServer;
public void start()
{
Resource res = new ClassPathResource("SpringHessianCallbackServerService.xml", SpringHessianHandler.class);
BeanFactory factory = new XmlBeanFactory(res);
springHessianCallbackServer = (SpringHessianCallbackServer)factory.getBean("springHessianCallbackServerService");
}
public SpringHessianCallbackServer getSpringHessianCallbackServer()
{
return springHessianCallbackServer;
}
public void setSpringHessianCallbackServer(SpringHessianCallbackServer springHessianCallbackServer)
{
this.springHessianCallbackServer = springHessianCallbackServer;
}
public void handleCallback(Callback callback) throws HandleCallbackException
{
System.out.println("Need to make call on SpringRMICallbackServer with results. " + callback);
try
{
springHessianCallbackServer.finishedProcessing(callback);
}
catch(Exception e)
{
e.printStackTrace();
throw new HandleCallbackException(e.getMessage());
}
}
}
1.1 date: 2006/08/13 19:30:05; author: telrod; state: Exp;JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/hessian/web/SpringHessianServer.java
Index: SpringHessianServer.java
===================================================================
/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.test.remoting.performance.spring.hessian.web;
/**
* @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
*/
public interface SpringHessianServer
{
public Object makeCall(Object obj, Object param);
public Object sendNumberOfCalls(Object obj, Object param);
}
1.1 date: 2006/08/13 19:30:05; author: telrod; state: Exp;JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/hessian/web/SpringHessianServerImpl.java
Index: SpringHessianServerImpl.java
===================================================================
/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.test.remoting.performance.spring.hessian.web;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.jboss.test.remoting.performance.synchronous.CallTracker;
import org.jboss.test.remoting.performance.synchronous.Payload;
import java.util.Map;
/**
* @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
*/
public class SpringHessianServerImpl implements SpringHessianServer
{
private Map callTrackers = new ConcurrentHashMap();
public Object sendNumberOfCalls(Object obj, Object param)
{
System.out.println("sent number of calls " + obj + " " + param);
String sessionId = (String) obj;
Integer totalCountInteger = (Integer) param;
int totalCount = totalCountInteger.intValue();
System.out.println("received totalCallCount call with total count of " + totalCount + " from " + sessionId);
CallTracker tracker = (CallTracker) callTrackers.get(sessionId);
if (tracker != null)
{
tracker.createTotalCount(totalCount);
}
else
{
SpringHessianHandler callbackHandler = new SpringHessianHandler();
callbackHandler.start();
tracker = new CallTracker(sessionId, callbackHandler);
callTrackers.put(sessionId, tracker);
tracker.createTotalCount(totalCount);
}
return totalCountInteger;
}
public Object makeCall(Object obj, Object param)
{
Payload payload = (Payload) param;
int clientInvokeCallCount = payload.getCallNumber();
String sessionId = (String) obj;
CallTracker tracker = (CallTracker) callTrackers.get(sessionId);
if (tracker != null)
{
tracker.verifyClientInvokeCount(clientInvokeCallCount);
}
else
{
System.err.println("No call tracker exists for session id " + sessionId);
throw new RuntimeException("No call tracker exists for session id " + sessionId);
}
return new Integer(clientInvokeCallCount);
}
}
More information about the jboss-cvs-commits
mailing list