You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by stoil valchkov <sv...@gmail.com> on 2008/12/01 08:59:20 UTC
OutOfMemory with multiple calls to ServiceClient.createClient
Hi,
With this sample:
final String projectPath = "./";
final String wsdlURL = projectPath + "Version.wsdl";
final QName servicename = new QName("http://axisversion.sample
","Version");
final String portname = "VersionHttpSoap11Endpoint";
final String repository = projectPath;
final QName qnameOperation =new QName("http://axisversion.sample",
"getVersion");;
Definition wsdlDef = null;
try {
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
wsdlDef = reader.readWSDL(wsdlURL);
} catch (Exception e) {
// TODO: handle exception
}
String repoLocation = projectPath;
for (int i = 0; i < 1000; i++) {
ConfigurationContext ctx=null;
ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoLocation,
null);
ServiceClient serviceClient;
synchronized (wsdlDef) {
serviceClient = new ServiceClient(ctx, wsdlDef, servicename,
portname);
}
OperationClient operClient =
serviceClient.createClient(qnameOperation);
serviceClient.cleanup();
}//end if
each time I get OutOfMemory and the reson seems to be not stopped Timer
threads.
Calling in addition serviceClient.getAxisConfiguration().cleanup(); solves
this problem.
Now the question - what's the cleanup needed here? Is it ok if I add a call
to AxisConfiguration.cleanup()?
If so - isn't it better to be added in ServiceClient.cleanup()?
Best regards,
Stoil