我正在开发 CXF 客户端服务,但负载测试(1000 个并发用户)会导致大量线程锁定和 JVM 崩溃。线程似乎被锁定在 Jaxb 类 AccessorInjector 上:
com/sun/xml/bind/v2/runtime/reflect/opt/AccessorInjector@341F3D78/341F3D84
我的客户是一个由 servlet 调用的单例。客户端像这样调用网络服务:
HttpServlet:
SRecherche srech = SRecherche .getInstance();
String reponse = srech.recherche(parametres, retour);
客户服务 :
public static SRecherche getInstance() {
synchronized (SRecherche .class) {
if (instance == null) {
instance = new SRecherche();
}
}
return instance;
}
.
.
.
.
public String recherche(String parametres, String retour[]) {
SampleSOAPService sampleSOAPService = new SampleSOAPService(ClassLoader.getSystemResource("service.wsdl"));
SampleSOAP s = sampleSOAPService .getService();
((BindingProvider) s).getRequestContext().put("thread.local.request.context", "true");
// set the username and password
((BindingProvider) s).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
((BindingProvider) s).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
//set timeout to be longer
Client client = ClientProxy.getClient(s);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(timeout);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(timeout);
httpClientPolicy.setConnection(ConnectionType.CLOSE);
http.setClient(httpClientPolicy);
.
.
.
s.callService(...);
.
.
}
我正在开发 weblogic 9.2/Java 5.0/CXF 2.5
您是否知道该客户端的同时调用有多少可能导致线程锁定?
JDK版本:
J2RE 5.0 IBM J9 2.3 AIX ppc-32 build j9vmap3223-20081129
JVM参数:
-Xjcl:jclscar_23
-Dcom.ibm.oti.vm.bootstrap.library.path=/usr/java5/jre/bin
-Dsun.boot.library.path=/usr/java5/jre/bin
-Djava.library.path=/usr/java5/jre/bin:/usr/java5/jre/bin:/usr/java5/jre/bin/classic:/usr/java5/jre/bin:/exec/products/weblogic/v9.2/bea/patch_weblogic921/profiles/default/native:/exec/products/weblogic/v9.2/server/native/aix/ppc:/usr/java5/jre/bin/j9vm:/usr/lib
-Djava.home=/usr/java5/jre
-Djava.ext.dirs=/usr/java5/jre/lib/ext
-Duser.dir=/exec/products/weblogic/v9.2/user_projects/domains/rforce
_j2se_j9=70912 0xF12ACF08
vfprintf 0x300017A4
-Xms2048m
-Xmx2048m
-Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0
-da
-Dplatform.home=/exec/products/weblogic/v9.2
-Dwls.home=/exec/products/weblogic/v9.2/server
-Dwli.home=/exec/products/weblogic/v9.2/integration
-Dweblogic.management.discover=true
-Dwlw.iterativeDev=false
-Dwlw.testConsole=false
-Dwlw.logErrorsToConsole=
-Dweblogic.ext.dirs=/exec/products/weblogic/v9.2/bea/patch_weblogic921/profiles/default/sysext_manifest_classpath
-Dcom.wily.introscope.agentProfile=/exec/products/weblogic/introscope/wily/IntroscopeAgent_prod.profile
-javaagent:/exec/products/weblogic/introscope/wily/Agent.jar
-Dcom.wily.introscope.agent.agentName=RFORCE
-Dweblogic.Name=RForceServer
-Djava.security.policy=/exec/products/weblogic/v9.2/server/lib/weblogic.policy
-Dinvokedviajava
-Djava.class.path=/exec/products/weblogic/v9.2/server/lib/geronimo-ws-metadata_2.0_spec-1.1.3.jar:/exec/products/weblogic/v9.2/user_projects/domains/rforce/config/rforce/:/exec/products/weblogic/v9.2/user_projects/domains/rforce/config/rforce/wsdl/drakkar/:/usr/java5/lib/tools.jar:/exec/products/weblogic/v9.2/server/lib/weblogic_sp.jar:/exec/products/weblogic/v9.2/server/lib/weblogic.jar:/exec/products/weblogic/v9.2/server/lib/webservices.jar::/exec/products/weblogic/v9.2/common/eval/pointbase/lib/pbclient51.jar:/exec/products/weblogic/v9.2/server/lib/xqrl.jar::
vfprintf
_port_library 0xF12AC748
-Xdump
谢谢,西蒙