List of usage examples for com.google.common.util.concurrent Monitor enterWhen
public void enterWhen(Guard guard) throws InterruptedException
From source file:org.apache.jackrabbit.oak.segment.SegmentBufferWriterPool.java
/** * Same as {@code monitor.enterWhen(guard)} but copes with that pesky {@code * InterruptedException} by catching it and setting this thread's * interrupted flag.//from w w w .j av a 2 s .c o m */ private static boolean safeEnterWhen(Monitor monitor, Guard guard) { try { monitor.enterWhen(guard); return true; } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); return false; } }