Page 1 of 1

HistoryBeginPing non-daemon threads

Posted: Fri Jul 11, 2008 3:14 pm
by smartbear
I'm using the 4.1.2 Vault client api. Every call to ServerOperations.ProcessCommandHistory appears to be launching a thread named HistoryBeginPing that sleeps 120 seconds before terminating. Because they're non-daemon threads, my Java app just sits there waiting for them to terminate. I can do a System.exit() or interrupt() to terminate my app, but since these are non-daemon threads, supposedly they shouldn't be terminated.

Are they there for a reason? As a workaround, is it safe to interrupt() them?

Posted: Mon Jul 14, 2008 7:44 am
by shannon
There's no important work being done in that thread. It exists to make sure that no firewalls or proxies time out our connection while we're doing something. It's safe to kill the thread.

In case you run into any of these, here are other names that it uses:

EndTxPing
HistoryFavoriteBeginPing
HistoryBeginPing
BeginLabelQueryPing
GetRepositoryPropertiesPing
DeleteRepositoryPing
BeginLabelQueryForFolderExportPing

Posted: Mon Jul 14, 2008 2:29 pm
by smartbear
Great, thanks. This works:

final ThreadGroup parentGroup = Thread.currentThread().getThreadGroup().getParent();
final Thread[] threads = new Thread[parentGroup.activeCount()];
parentGroup.enumerate(threads);
for (Thread thread : threads) {
if ("HistoryBeginPing".equals(thread.getName())) {
try {
thread.checkAccess();
thread.interrupt();
}
catch (SecurityException e) {}
}
}