improve alert

skip doing false alert when the coordinator looses leadership
This commit is contained in:
nishantmonu51 2015-03-18 09:42:22 +05:30
parent 36b4c6a371
commit 21cd75bcf6
1 changed files with 7 additions and 2 deletions

View File

@ -86,6 +86,7 @@ public class LoadQueuePeon
private final Object lock = new Object();
private volatile SegmentHolder currentlyProcessing = null;
private boolean stopped = false;
LoadQueuePeon(
CuratorFramework curator,
@ -209,9 +210,12 @@ public class LoadQueuePeon
{
synchronized (lock) {
try {
// expected when the coordinator looses leadership and LoadQueuePeon is stopped.
if (currentlyProcessing == null) {
log.makeAlert("Crazy race condition! server[%s]", basePath)
.emit();
if(!stopped) {
log.makeAlert("Crazy race condition! server[%s]", basePath)
.emit();
}
actionCompleted();
doNext();
return;
@ -347,6 +351,7 @@ public class LoadQueuePeon
queuedSize.set(0L);
failedAssignCount.set(0);
stopped = true;
}
}