Grab the thread name in a poisoned pool (#13143)

This commit is contained in:
imply-cheddar 2022-09-27 09:09:10 +09:00 committed by GitHub
parent 0bfa81b7df
commit e839660b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import org.apache.druid.java.util.common.Cleaners;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.RE;
import org.apache.druid.java.util.common.logger.Logger;
import java.lang.ref.WeakReference;
@ -156,7 +157,7 @@ public class StupidPool<T> implements NonBlockingPool<T>
if (POISONED.get()) {
final RuntimeException exception = capturedException.get();
if (exception == null) {
resourceHolder.notifier.except = new RuntimeException("leaky leak!");
resourceHolder.notifier.except = new RE("Thread[%s]: leaky leak!", Thread.currentThread().getName());
} else {
throw exception;
}
@ -316,7 +317,7 @@ public class StupidPool<T> implements NonBlockingPool<T>
poolReference = new WeakReference<>(pool);
leakedObjectsCounter = pool.leakedObjectsCounter;
except = poisoned ? new RuntimeException("drip drip") : null;
except = poisoned ? new RE("Thread[%s]: drip drip", Thread.currentThread().getName()) : null;
}
@Override