|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
IDE是好。java中的IDE更是百花齐放,你用jbuilder能说jbuilder赶不上vs吗?用eclipse,net网页编程beans也很舒服啊。我就不明白“稍微差一些”那一些是从哪里差来的。RMI设置申明:
1:对象序列化:
publicclassAccountimplementsSerializable{
privateStringname;
publicStringgetName(){
returnname;
}
publicvoidsetName(Stringname){
this.name=name;
}
}
2:远程接口界说:
publicinterfaceRemoteCallExampleextendsRemote{
publicStringshow()throwsRemoteException;
}
3:远程接话柄现:
publicclassRemoteCallExampleImplimplementsRemoteCallExample{
@Override
publicStringshow()throwsRemoteException{
return"remotetest";
}
}
4:Spring服务器端设置(利用RmiServiceExporter来):
在WEB-INF目次上面新建remoting-servlet.xml文件,增加相干的设置。
<beanname="remoteCallExample"class="com.hqb360.pay.service.impl.RemoteCallExampleImpl"/>
<beanclass="org.springframework.remoting.rmi.RmiServiceExporter">
<!–doesnotnecessarilyhavetobethesamenameasthebeantobeexported–>
<propertyname="serviceName"value="remoteCallExample"/>
<propertyname="service"ref="remoteCallExample"/>
<propertyname="serviceInterface"value="com.hqb360.pay.service.RemoteCallExample"/>
<!–defaultsto1099–>
<propertyname="registryPort"value="1199"/>
</bean>
5:服务器端类
publicclassRemoteCallRMI{
publicStringshow()throwsRemoteException{
returnremoteCallExample.show();
}
privateRemoteCallExampleremoteCallExample;
publicRemoteCallExamplegetRemoteCallExample(){
returnremoteCallExample;
}
publicvoidsetRemoteCallExample(RemoteCallExampleremoteCallExample){
this.remoteCallExample=remoteCallExample;
}
}
6:服务器端设置
<beanname="remoteCallRMI"class="com.hqb360.pay.service.impl.RemoteCallRMI">
<propertyname="remoteCallExample"ref="remoteCall"/>
</bean>
<beanid="remoteCall"class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<propertyname="serviceUrl"value="rmi://192.168.100.10:1199/remoteCallExample"/>
<propertyname="serviceInterface"value="com.hqb360.pay.service.RemoteCallExample"/>
</bean>
一些RMI成绩申明:
1.RMI在启动设置中必要增加:-Djava.rmi.server.hostname=192.168.100.10
2.必要制订相干的详细IP,把读取设置文件放到体系启动的时分处置。
Spring3.0后默许的HandlerMapping是DefaultAnnotationHandlerMapping,不是之前的BeanNameUrlHandlerMapping,以是设置Hessian和HttpInvoker的时分必要从头界说一下HandlerMapping.
在依照spring手册设置的时分必要增加界说(Spring文档有漏掉的中央):
<!–Hessian启动BeanNameMapping映照功效,以httpRequest作为处置Adapter–>
<beanclass="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<propertyname="defaultHandler"ref="httpRequestHandlerAdapter"/>
</bean>
<!–Hessian体例以Http举行传送–>
<beanid="httpRequestHandlerAdapter"class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
测试了局
测试功能:RMI>Hessian>HttpInvoker
数据图表以下:
<br>
RMI
RMI并发测试(线程池巨细:5,线程数:5)
[TestRunner]StartingexecutortimeOut:1000000msworkers:5threadPoolSize:5
0[5,880ms,100%]
0[5,881ms,100%]
0[5,977ms,100%]
0[5,978ms,100%]
0[5,989ms,100%]
RemoteTestNGfinishing:8318ms
RMI并发测试(线程池巨细:5,线程数:10)
[TestRunner]StartingexecutortimeOut:1000000msworkers:10threadPoolSize:5
0[5,843ms,100%]
0[5,856ms,100%]
0[5,864ms,100%]
0[5,967ms,100%]
0[5,970ms,100%]
0[5,795ms,100%]
0[5,810ms,100%]
0[5,812ms,100%]
0[5,891ms,100%]
0[5,935ms,100%]
RemoteTestNGfinishing:14194ms
Httpinvoker
并发测试(线程池巨细:5,线程数:5)
[TestRunner]StartingexecutortimeOut:100000msworkers:5threadPoolSize:5
0[24,350ms,100%]
0[25,384ms,100%]
0[27,601ms,100%]
0[27,700ms,100%]
0[29,443ms,100%]
RemoteTestNGfinishing:31737ms
并发测试(线程池巨细:5,线程数:10)
[TestRunner]StartingexecutortimeOut:1000000msworkers:10threadPoolSize:5
0[26,519ms,100%]
0[26,637ms,100%]
0[28,365ms,100%]
0[29,744ms,100%]
0[29,821ms,100%]
0[28,433ms,100%]
0[29,914ms,100%]
0[31,795ms,100%]
0[28,959ms,100%]
0[29,407ms,100%]
RemoteTestNGfinishing:61477ms
hessian测试了局
并发测试(线程池巨细:5,线程数:5)
[TestRunner]StartingexecutortimeOut:100000msworkers:5threadPoolSize:5
0[13,343ms,100%]
0[13,957ms,100%]
0[14,544ms,100%]
0[14,612ms,100%]
0[14,822ms,100%]
RemoteTestNGfinishing:17133ms
并发测试(线程池巨细:5,线程数:10)
[TestRunner]StartingexecutortimeOut:100000msworkers:10threadPoolSize:5
0[13,407ms,100%]
0[14,058ms,100%]
0[14,271ms,100%]
0[14,293ms,100%]
0[18,198ms,100%]
0[14,496ms,100%]
0[15,128ms,100%]
0[16,478ms,100%]
0[17,680ms,100%]
0[17,317ms,100%]
RemoteTestNGfinishing:37844ms
必要测试代码的接洽:longtask@gmail.com
微软什么都提供了。你可以试想一下,如果你是新手,你是希望你点一下按钮程序就能运行那,还是想自己一点一点的组织结构,然后打包发部,调错再打包...... |
|