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?
HistoryBeginPing non-daemon threads
Moderator: SourceGear
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
In case you run into any of these, here are other names that it uses:
EndTxPing
HistoryFavoriteBeginPing
HistoryBeginPing
BeginLabelQueryPing
GetRepositoryPropertiesPing
DeleteRepositoryPing
BeginLabelQueryForFolderExportPing
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) {}
}
}
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) {}
}
}