[
https://issues.apache.org/jira/browse/ZOOKEEPER-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521346#comment-14521346
]
Bob commented on ZOOKEEPER-1920:
--------------------------------
[~rakeshr] Thanks for your reply.
{quote}
ZooKeeperSaslClient login object is static and the thread is created only once
for the lifetime of that application(I mean per jvm). It looks like its done
intentionally, isn't it?
{quote}
Ideally static login object will control one login thread in one JVM. I came
across one scenario is like Following:
One application will create one zk client and this will loads class
separately.Here we will run multiple applications continuously in single java
class ( which means single JVM ) where we seen login object getting created for
every application which is not getting closed even we call zk.close .
*Application which will called for every time in single Java Class*
{code}
classLoader = new MyClassloader(new URL[] {});
try {
File file = new File(libPath);
File[] jarsFiles = file.listFiles();
for (File jarFile : jarsFiles) {
LOGGER.info("load jar: {}",
jarFile.getAbsolutePath());
classLoader.addJar(jarFile.toURL());
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
servlet = (PretendedServlet)Class.forName("com.zk.PretendedZK",
true, classLoader).newInstance();
servlet.init();
{code}
*Zkclient Threads which we are using same in init*
{code}
public void init() {
if (null == login) {
LOGGER.info("init login.");
login = new PretendedLogin();
login.start();
}
startSendThread();
startEventThread();
}
{code}
> Login thread is not shutdown when close the ClientCnxn
> ------------------------------------------------------
>
> Key: ZOOKEEPER-1920
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1920
> Project: ZooKeeper
> Issue Type: Bug
> Components: java client
> Affects Versions: 3.4.6
> Reporter: liuyang
> Assignee: Rakesh R
> Priority: Minor
>
> A new ZooKeeper client will start three threads, the SendThread, EventThread
> and LoginThread. I belive that these threads will be shutdown after call the
> zk.close. I test that the SendThread and EventThread will be die, but
> LoginThread is still alive. The stack is:
> "Thread-0" daemon prio=10 tid=0x00007ffcf0020000 nid=0x69c8 waiting on
> condition [0x00007ffd3cc25000]
> java.lang.Thread.State: TIMED_WAITING (sleeping)
> at java.lang.Thread.sleep(Native Method)
> at org.apache.zookeeper.Login$1.run(Login.java:183)
> at java.lang.Thread.run(Thread.java:744)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)