mirror of
https://github.com/apache/lucene.git
synced 2025-02-12 13:05:29 +00:00
SOLR-10376: Handle InterruptedException thrown by lock.lockInterruptibly() separately
This commit is contained in:
parent
12933ee4a7
commit
50fdf6ac7a
@ -100,25 +100,34 @@ public class OverseerTriggerThread implements Runnable, Closeable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
Map<String, AutoScaling.Trigger> copy = null;
|
Map<String, AutoScaling.Trigger> copy = null;
|
||||||
try {
|
try {
|
||||||
|
// this can throw InterruptedException and we don't want to unlock if it did, so we keep this outside
|
||||||
|
// of the try/finally block
|
||||||
updateLock.lockInterruptibly();
|
updateLock.lockInterruptibly();
|
||||||
if (znodeVersion == lastZnodeVersion) {
|
try {
|
||||||
updated.await();
|
if (znodeVersion == lastZnodeVersion) {
|
||||||
|
updated.await();
|
||||||
|
|
||||||
// are we closed?
|
// are we closed?
|
||||||
if (isClosed) break;
|
if (isClosed) break;
|
||||||
|
|
||||||
// spurious wakeup?
|
// spurious wakeup?
|
||||||
if (znodeVersion == lastZnodeVersion) continue;
|
if (znodeVersion == lastZnodeVersion) continue;
|
||||||
lastZnodeVersion = znodeVersion;
|
lastZnodeVersion = znodeVersion;
|
||||||
|
}
|
||||||
|
copy = new HashMap<>(activeTriggers);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// Restore the interrupted status
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
log.warn("Interrupted", e);
|
||||||
|
break;
|
||||||
|
} finally {
|
||||||
|
updateLock.unlock();
|
||||||
}
|
}
|
||||||
copy = new HashMap<>(activeTriggers);
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// Restore the interrupted status
|
// Restore the interrupted status
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
log.warn("Interrupted", e);
|
log.warn("Interrupted", e);
|
||||||
break;
|
break;
|
||||||
} finally {
|
|
||||||
updateLock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> managedTriggerNames = scheduledTriggers.getScheduledTriggerNames();
|
Set<String> managedTriggerNames = scheduledTriggers.getScheduledTriggerNames();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user