[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjms-developer
Subject:    [openjms-developer] [ openjms-Bugs-1558357 ] ClassCastException in
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2006-09-14 5:13:32
Message-ID: E1GNjXY-0001hP-Ud () sc8-sf-web2 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1558357, was opened at 2006-09-14 13:11
Message generated for change (Settings changed) made by edwin11
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1558357&group_id=54559

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: server
Group: v0.7.6.1
Status: Open
Resolution: None
>Priority: 7
Submitted By: Edwin Lee (edwin11)
Assigned to: Nobody/Anonymous (nobody)
Summary: ClassCastException in MultiplexConnectionServer

Initial Comment:
Calling
org.exolab.core.mipc.MultiplexConnectionServer.shutdownAll()
will cause a ClassCastException.

Here is why.

In MultiplexConnectionServer.run(), whenever a socket
connection is accepted, a new MultiplexConnection
object (subclass of Thread) is created and placed in
the ThreadGroup object, _connections. The thread is
then started.

So far so good.

However, in MultiplexConnection.run(), a MessageCopier
object is created. MessageCopier is also a subclass of
Thread, and as a ThreadGroup is not specified when
invoking the super constructor, it is placed in the
same ThreadGroup as its parent thread, the
MultiplexConnection object, and that is the ThreadGroup
_connections in MultiplexConnectionServer.

Hence, the ThreadGroup _connections in
MultiplexConnectionServer contains both
MultiplexConnection objects and MessageCopier objects.
MultiplexConnection is a subclass of
MultiplexConnectionIfc, but MessageCopier is not.

Therefore, in the shutdownAll() method of
MultiplexConnectionServer, the line

((MultiplexConnectionIfc) connections[i]).finish();

causes a ClassCastException (trying to cast an instance
of MessageCopier to the type MultiplexConnectionIfc).


i would propose replacing the above line with:

if (connections[i] instanceof MultiplexConnectionIfc)
{
    ((MultiplexConnectionIfc) connections[i]).finish();
}
else if (connections[i] instanceof MessageCopier)
{
    ((MessageCopier) connections[i]).finish();
}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1558357&group_id=54559

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
openjms-developer mailing list
openjms-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openjms-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic