此 JAX-WS 客户机调用线程是否安全?
由于 WS 客户端服务和端口的初始化需要很长时间,因此我喜欢在启动时初始化它们一次,然后重用端口的同一实例。初始化将如下所示:
private static RequestContext requestContext = null;
static
{
MyService service = new MyService();
MyPort myPort = service.getMyServicePort();
Map<String, Object> requestContextMap = ((BindingProvider) myPort).getRequestContext();
requestContextMap = ((BindingProvider)myPort).getRequestContext();
requestContextMap.put(BindingProvider.USERNAME_PROPERTY, uName);
requestContextMap.put(BindingProvider.PASSWORD_PROPERTY, pWord);
rc = new RequestContext();
rc.setApplication("test");
rc.setUserId("test");
}
我班上某处的电话:
myPort.someFunctionCall(requestContext, "someValue");
我的问题:这个调用是线程安全的吗?