axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
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 =
configContext.getListenerManager();
        if (transportManager == null) {
            transportManager = new ListenerManager();
            transportManager.init(this.configContext);
        }

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:

                if
(!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?

Thanks,
Hiranya

-- 
Hiranya Jayathilaka
Senior Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Mime
View raw message