If the init method is called twice on the same instance, then this is
a very serious bug: in the case of AbstractTransportListener, it would
cause the transport to leak an entire thread pool! Maybe this issue is
caused by Ruwan's patch (or Glen's corrections to that patch) for
AXIS2-4304.

Andreas

On Wed, Nov 4, 2009 at 05:56, Amila Suriarachchi
<amilasuriarach...@gmail.com> wrote:
> On Wed, Nov 4, 2009 at 1:33 AM, Andreas Veithen
> <andreas.veit...@gmail.com>wrote:
>
>> Amila,
>>
>> Can you check this again? If the init method is called twice on the
>> same instance, then this would be a huge bug (because it would cause
>> an important resource leak).
>
> you can do a simple send and receive invocation with mail transport to check
> this.
>
> this method of ListenerManager causes problem.
>
> public synchronized void addListener(TransportInDescription
> trsIn,
>                                     boolean started) throws AxisFault
> {
>
> configctx.getAxisConfiguration().addTransportIn(trsIn);
>
>    TransportListener transportListener =
> trsIn.getReceiver();
>    if (transportListener != null)
> {
>        if (!started)
> {
>            transportListener.init(configctx,
> trsIn);
>
> transportListener.start();
>
>            if (shutdownHookThread == null && isShutdownHookRequired())
> {
>                shutdownHookThread = new
> ListenerManagerShutdownThread(this);
>
> Runtime.getRuntime().addShutdownHook(shutdownHookThread);
>
> }
>
>            stopped =
> false;
>
> }
>
>        startedTransports.put(trsIn.getName(),
> transportListener);
>
> }
>
> }
>
> if the listener is not started it calls init as well.  I did not try
> removing it since it might
> cause some other problem.
>
>
>
> On the other hand, if the init method is
>> called a second time on a different instance, then the test
>> mbeanSupport == null will have no effect since mbeanSupport is an
>> instance attribute.
>
> I commit since it has an effect :). It calls on the same object.
>
> thanks,
> Amila.
>
>
>> Note that if two instances of the same transport
>> (extending AbstractTransport) run in the same VM, there is indeed an
>> issue with JMX because both instances try to bind an MBean to the same
>> name. This however only results in a warning.
>>
>> Andreas
>>
>> On Tue, Nov 3, 2009 at 05:05,  <ami...@apache.org> wrote:
>> > Author: amilas
>> > Date: Tue Nov  3 04:05:45 2009
>> > New Revision: 832297
>> >
>> > URL: http://svn.apache.org/viewvc?rev=832297&view=rev
>> > Log:
>> > register an mbean only if it is not call once. when doing an in out
>> operaton with mail
>> > transport gives an exception at client side since it causes call init
>> method twice.
>> >
>> > Modified:
>> >
>>  webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
>> >
>> > Modified:
>> webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
>> > URL:
>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java?rev=832297&r1=832296&r2=832297&view=diff
>> >
>> ==============================================================================
>> > ---
>> webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
>> (original)
>> > +++
>> webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
>> Tue Nov  3 04:05:45 2009
>> > @@ -129,8 +129,11 @@
>> >                 });
>> >
>> >         // register with JMX
>> > -        mbeanSupport = new TransportMBeanSupport(this,
>> getTransportName());
>> > -        mbeanSupport.register();
>> > +        if (mbeanSupport == null) {
>> > +            mbeanSupport = new TransportMBeanSupport(this,
>> getTransportName());
>> > +            mbeanSupport.register();
>> > +        }
>> > +
>> >     }
>> >
>> >     public void destroy() {
>> >
>> >
>> >
>>
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>

Reply via email to