[
https://issues.apache.org/jira/browse/ZOOKEEPER-1394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15611961#comment-15611961
]
wu wen commented on ZOOKEEPER-1394:
-----------------------------------
i think this is a class loading time problem,If ZooTrace.xxx() has been used
already before the application stopped, it can be loaded normally.
{code:java}
class SendThread extends Thread {
//..igonre
@Override
public void run() {
//..igonre
//*********for example, If ZooTrace is called here, the problem
does not occur.*******
ZooTrace.logTraceMessage(LOG, ZooTrace.getTextTraceLevel(),
"SendThread starting loop.");
while (state.isAlive()) {
//..igonre
//there is loop
}
//...executing
/***At this time, may be this web application instance has been
stopped already.**/
/**java.lang.IllegalStateException: Illegal access: this web application
instance has been stopped already. Could not load
[org.apache.zookeeper.server.ZooTrace]**/
//The container seems to think this is an illegal load
ZooTrace.logTraceMessage(LOG, ZooTrace.getTextTraceLevel(),
"SendThread exitedloop.");
}
void close() {
state = States.CLOSED;
clientCnxnSocket.wakeupCnxn();
}
}
{code}
> ClassNotFoundException on shutdown of client
> --------------------------------------------
>
> Key: ZOOKEEPER-1394
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1394
> Project: ZooKeeper
> Issue Type: Bug
> Components: java client
> Affects Versions: 3.4.2
> Environment: OS X 10.7 java version "1.6.0_29"
> Reporter: Herman Meerlo
> Assignee: wu wen
> Priority: Minor
> Attachments: ZOOKEEPER-1394.patch
>
>
> When close() is called on the ZooKeeper instance from a ContextListener
> (contextDestroyed) there is no way to synchronize with the fact that the
> EventThread and SendThread have actually finished their work. The problem
> lies in the SendThread which makes a call to ZooTrace when it exits, but that
> class has not been loaded yet. Because the ContextListener could not
> synchronize with the death of the threads the classloader has already
> disappeared, resulting in a ClassNotFoundException.
> My personal opinion is that the close() method should probably wait until the
> event and send thread have actually died.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)