Hi all,
I'm testing this chunk of code
protected void send(T r, String node) throws AxisFault {
long start = System.currentTimeMillis();
// Creates the endpoint
String target = createTargetPath(node);
long one = System.currentTimeMillis();
EndpointReference targetEPR = new EndpointReference(target);
// Creates and fills the options
Options options = createOptions(r.getWSAction(), targetEPR);
long two = System.currentTimeMillis();
ServiceClient sender = null;
long three = 0L, four = 0L, five = 0L, six = 0L;
try {
sender = new ServiceClient
(WorkerConfiguration.getConfigurationContext(),
null);
three = System.currentTimeMillis();
synchronized (lock) {
sender.engageModule(Constants.MODULE_ADDRESSING);
}
four = System.currentTimeMillis();
sender.setOptions(options);
SOAPHeaderBlock qospBlock = createHeader(r, true);
sender.addHeader(qospBlock);
five = System.currentTimeMillis();
sender.fireAndForget(r.getRequest());
six = System.currentTimeMillis();
// waitDelivery();
if (log.isTraceEnabled()) {
log.trace("request sent to [" + options.getTo
().getAddress() + "]");
}
} finally {
if (sender != null) {
try {
sender.cleanup();
} catch (AxisFault e) {
// ignore
}
}
long stop = System.currentTimeMillis();
System.out.printf("Times %d %d %d %d %d %d %d total %d\n",
(one - start), (two - one), (three - two), (four - three), (five -
four), (six - five), (stop - six), (stop - start));
}
}
The ouput is the following
Times 0 6 1862 1 15 96 0 total 1980, which means that the instruction
new ServiceClient(...) takes almost 2 seconds to execute.
Am I doing anything wrong? Is there anything I could do to speed up
the method above? How can I effectively reuse the same service client
(shared between different threads)?
Thanks,
Michele
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]