Less verbose exception

This commit is contained in:
Andrea Cavalli 2021-09-07 11:39:13 +02:00
parent dd1ed1d18f
commit a662033228

View File

@ -8,6 +8,7 @@ import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.util.concurrent.Phaser; import java.util.concurrent.Phaser;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
import java.util.function.Function; import java.util.function.Function;
@ -197,7 +198,11 @@ public class CachedIndexSearcherManager {
try { try {
activeRefreshes.awaitAdvanceInterruptibly(activeRefreshes.arrive(), 15, TimeUnit.SECONDS); activeRefreshes.awaitAdvanceInterruptibly(activeRefreshes.arrive(), 15, TimeUnit.SECONDS);
} catch (Exception ex) { } catch (Exception ex) {
logger.error("Failed to terminate active refreshes", ex); if (ex instanceof TimeoutException) {
logger.error("Failed to terminate active refreshes: timeout");
} else {
logger.error("Failed to terminate active refreshes", ex);
}
} }
} }
logger.info("Closed refreshes..."); logger.info("Closed refreshes...");
@ -206,7 +211,11 @@ public class CachedIndexSearcherManager {
try { try {
activeSearchers.awaitAdvanceInterruptibly(activeSearchers.arrive(), 15, TimeUnit.SECONDS); activeSearchers.awaitAdvanceInterruptibly(activeSearchers.arrive(), 15, TimeUnit.SECONDS);
} catch (Exception ex) { } catch (Exception ex) {
logger.error("Failed to terminate active searchers", ex); if (ex instanceof TimeoutException) {
logger.error("Failed to terminate active searchers: timeout");
} else {
logger.error("Failed to terminate active searchers", ex);
}
} }
} }
logger.info("Closed active searchers"); logger.info("Closed active searchers");