in src/main/java/com/spotify/sparkey/extra/PersistentThreadLocal.java [102:116]
protected void cleanupDeadThreads() {
RefWithThreadId ref = (RefWithThreadId) deadThreads.poll();
while (ref != null) {
final T value = fallback.remove(ref.threadId);
activeThreads.remove(ref.threadId);
if (value != null) {
try {
closer.accept(value);
} catch (Exception e) {
// Ignore exceptions, we can't crash the current thread
}
}
ref = (RefWithThreadId) deadThreads.poll();
}
}