问题描述
publicclassTestStub3implementsRunnable{publicstaticLoggerlogger=Logger.getLogger(TestStub3.class);privatestaticConfigurationContextctx=null;privatestaticResourceBundlerb=ResourceBundle.getBundle("usif");static{try{ctx=ConfigurationContextFactory.createConfigurationContextFromFileSystem(rb.getString("EnginePath"),rb.getString("EnginePath")+"/cfg/axis2.xml");}catch(AxisFaulte1){e1.printStackTrace();}}publicstaticvoidmain(String[]args)throwsRemoteException{newTestStub3().callTest();for(inti=0;i<100;i++){newThread(newTestStub3()).start();}}publicvoidcallTest()throwsRemoteException{//NormalStubstub=newNormalStub(ctx,"http://172.21.0.132:51300/esbWS/services/PerformanceTest");NormalStubstub=newNormalStub("http://172.21.0.132:51300/esbWS/services/PerformanceTest2");//NormalStubstub=newNormalStub(ctx,"http://172.21.0.132:51300/esbWS/services/PerformanceTest2",false);//NormalStubstub=newNormalStub(ctx,"http://127.0.0.1:51300/esbWS/services/PerformanceTest");NormalStub.CallServicecallService=newNormalStub.CallService();String[]param={"aa","bbb"};callService.setParams(param);longstartMillin=System.currentTimeMillis();NormalStub.CallServiceResponseresp=stub.callService(callService);NormalStub.SrvReturnBeanbean=resp.get_return();logger.info("-"+bean.getRetCode()+","+bean.getRetMsg()+"||lastTime="+(System.currentTimeMillis()-startMillin));//Thread.sleep(50);}publicvoidrun(){intnum=1000;while(num>0){num--;try{this.callTest();}catch(Exceptione){e.printStackTrace();}}}}====================================================================用如上方式测试,可是发现是串行调用服务端,没有实现并发调用,请问如何实现并发。采用axis2非客户端生成的代码,完全手动写客户端代码方式调用服务端,也无法实现并发。以前用的是axis1.4版本,这个版本按照上面的方式就可以实现并发调用服务端。