litterat
Mar 12th, 2012, 10:24 AM
Hi All
I wrote a smal service class which return a list with 1000 strings.
I am using Httpinvoker to get the service and read the list. If the number of the elements in the list is 100 all is going well when
I try 1000 it freeze utill there is a connection reset
The client side is JUnit 4 class with spring runner on the same machine
by the way the same is happening with Hessian protocol.
They are both HTML based but this is the only connection I can see RMI and JMS RMI is working fine with the same service
The service code
public class DateServiceImpl implements DateService {
/* (non-Javadoc)
* @see com.successcharging.rmiexample.DateService#getDate ()
*/
@Override
public Date getDate() {
return new Date();
}
@Override
public List<String> getBigList() {
List<String> listData = new ArrayList<String>();
for (int i = 0 ; i < 100;i++) {
listData.add(Math.random()+"");
}
return listData;
}
}
The mapping server side
<!-- The service to use this is the server side -->
<bean id="dateServiceServer" class="com.successcharging.rmiexample.server.DateServiceI mpl" />
<!-- the http invoker protocol -->
<bean name="/DateServiceHttpInvoker"
class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service" ref="dateServiceServer" />
<property name="serviceInterface"
value="com.successcharging.rmiexample.server.DateService" />
</bean>
The client mapping
<bean id="dateServiceHttpInvokerClient"
class="org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean">
<property name="serviceUrl"
value="http://localhost:8080/Remoting_example/DateServiceHttpInvoker" />
<property name="serviceInterface"
value="com.successcharging.rmiexample.server.DateService" />
</bean>
The junit code
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class DateServiceTest extends BaseTest {
@Resource
private DateService dateServiceHttpInvokerClient;
@Test
public void testDateServiceHttpInvoker() {
List<String> data = dateServiceHttpInvokerClient.getBigList(); //Here it is get stuck
data.add("My test");
System.out.println("HttpInvoker:"
+ data.size());
}
public DateService getDateServiceHttpInvokerClient() {
return dateServiceHttpInvokerClient;
}
public void setDateServiceHttpInvokerClient(
DateService dateServiceHttpInvoker) {
this.dateServiceHttpInvokerClient = dateServiceHttpInvoker;
}
}
Any ideas ?
I wrote a smal service class which return a list with 1000 strings.
I am using Httpinvoker to get the service and read the list. If the number of the elements in the list is 100 all is going well when
I try 1000 it freeze utill there is a connection reset
The client side is JUnit 4 class with spring runner on the same machine
by the way the same is happening with Hessian protocol.
They are both HTML based but this is the only connection I can see RMI and JMS RMI is working fine with the same service
The service code
public class DateServiceImpl implements DateService {
/* (non-Javadoc)
* @see com.successcharging.rmiexample.DateService#getDate ()
*/
@Override
public Date getDate() {
return new Date();
}
@Override
public List<String> getBigList() {
List<String> listData = new ArrayList<String>();
for (int i = 0 ; i < 100;i++) {
listData.add(Math.random()+"");
}
return listData;
}
}
The mapping server side
<!-- The service to use this is the server side -->
<bean id="dateServiceServer" class="com.successcharging.rmiexample.server.DateServiceI mpl" />
<!-- the http invoker protocol -->
<bean name="/DateServiceHttpInvoker"
class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service" ref="dateServiceServer" />
<property name="serviceInterface"
value="com.successcharging.rmiexample.server.DateService" />
</bean>
The client mapping
<bean id="dateServiceHttpInvokerClient"
class="org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean">
<property name="serviceUrl"
value="http://localhost:8080/Remoting_example/DateServiceHttpInvoker" />
<property name="serviceInterface"
value="com.successcharging.rmiexample.server.DateService" />
</bean>
The junit code
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class DateServiceTest extends BaseTest {
@Resource
private DateService dateServiceHttpInvokerClient;
@Test
public void testDateServiceHttpInvoker() {
List<String> data = dateServiceHttpInvokerClient.getBigList(); //Here it is get stuck
data.add("My test");
System.out.println("HttpInvoker:"
+ data.size());
}
public DateService getDateServiceHttpInvokerClient() {
return dateServiceHttpInvokerClient;
}
public void setDateServiceHttpInvokerClient(
DateService dateServiceHttpInvoker) {
this.dateServiceHttpInvokerClient = dateServiceHttpInvoker;
}
}
Any ideas ?