Skip to content
Permalink
Browse files

0001305: Possible lock up during extraction. If the max number of loc…

…ks are reached on a batch the extract method can hang forever
  • Loading branch information...
chenson42 committed Jul 1, 2013
1 parent cb9806f commit d9aaf3f593dd8bc47f3d69ed001d569381896c93
@@ -551,10 +551,11 @@ public OutgoingBatch extractOutgoingBatch(ProcessInfo processInfo, Node targetNo
if (currentBatch.getStatus() == Status.NE ||
!isPreviouslyExtracted(currentBatch)) {
int maxPermits = parameterService.getInt(ParameterConstants.CONCURRENT_WORKERS);
String semaphoreKey = streamToFileEnabled ? Long.toString(currentBatch.getBatchId()) : currentBatch.getNodeBatchId();
Semaphore lock = null;
try {
synchronized (locks) {
lock = locks.get(currentBatch.getBatchId());
lock = locks.get(semaphoreKey);
if (lock == null) {
lock = new Semaphore(maxPermits);
locks.put(currentBatch.getBatchId(), lock);
@@ -592,10 +593,10 @@ public OutgoingBatch extractOutgoingBatch(ProcessInfo processInfo, Node targetNo
}
throw ex;
} finally {
lock.release();
synchronized (locks) {
lock.release();
if (lock.availablePermits() == maxPermits) {
locks.remove(currentBatch.getBatchId());
locks.remove(semaphoreKey);
}
}
}

0 comments on commit d9aaf3f

Please sign in to comment.
You can’t perform that action at this time.