ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <>
Subject Problem with ServiceClient/ListenerManager
Date Tue, 25 May 2010 14:07:30 GMT
Hi Folks,

While debugging through the TCP test cases, I stumbled upon a little
problem. Let's say somebody creates a ServiceClient instance as follows:

ServiceClient sender = new ServiceClient(configContext, clientService);

When this is called, internally it will initialize a ListenerManager
instance. I found the following bit of code in the ServiceClient:

        // Initialize transports
        ListenerManager transportManager =
        if (transportManager == null) {
            transportManager = new ListenerManager();

This in turns initializes transport listeners. However ServiceClient does
not call start on the ListenerManager. Therefore none of the transports get
marked as started in the ListenerManager. Now, if I try to use the service
client to invoke a service with useSeparateListener set to true, the
following bit of code in the ClientUtils class is executed:

(!listenerManager.isListenerRunning(transportIn.getName())) {
                    listenerManager.addListener(transportIn, false);

The if condition evaluates to true since the listener has not been marked as
started. In addListener method the corresponding transport listener will be
initialized again. If an endpoint has been configured globally, this can
result in the same endpoint getting started twice thus potentially causing
bind exceptions. I'm experiencing this with the TCP transport now. Thoughts?


Hiranya Jayathilaka
Senior Software Engineer;
WSO2 Inc.;
E-mail:;  Mobile: +94 77 633 3491

View raw message