public void cancelAll(String callerUuid, Throwable cause) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (callerUuid.equals(op.getCallerUuid())) { entry.cancel(cause); } } }
public void invalidateAll(String callerUuid) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (callerUuid.equals(op.getCallerUuid())) { entry.setValid(false); } } }
public void cancelAll(String serviceName, Object objectId, Throwable cause) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } WaitNotifyKey wnk = entry.blockingOperation.getWaitKey(); if (serviceName.equals(wnk.getServiceName()) && objectId.equals(wnk.getObjectName())) { entry.cancel(cause); } } }
public void cancelAll(String serviceName, Object objectId, Throwable cause) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } WaitNotifyKey wnk = entry.blockingOperation.getWaitKey(); if (serviceName.equals(wnk.getServiceName()) && objectId.equals(wnk.getObjectName())) { entry.cancel(cause); } } }
public void invalidateAll(String callerUuid) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (callerUuid.equals(op.getCallerUuid())) { entry.setValid(false); } } }
public void cancelAll(String callerUuid, Throwable cause) { for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (callerUuid.equals(op.getCallerUuid())) { entry.cancel(cause); } } }
private boolean doRun() throws Exception { long waitTime = FIRST_WAIT_TIME; while (waitTime > 0) { long begin = System.currentTimeMillis(); WaitSetEntry entry = (WaitSetEntry) delayQueue.poll(waitTime, MILLISECONDS); if (entry != null) { if (entry.isValid()) { invalidate(entry); } } long end = System.currentTimeMillis(); waitTime -= (end - begin); if (waitTime > FIRST_WAIT_TIME) { waitTime = FIRST_WAIT_TIME; } } for (WaitSet waitSet : waitSetMap.values()) { if (Thread.interrupted()) { return true; } for (WaitSetEntry entry : waitSet) { if (entry.isValid() && entry.needsInvalidation()) { invalidate(entry); } } } return false; }
private boolean doRun() throws Exception { long waitTime = FIRST_WAIT_TIME; while (waitTime > 0) { long begin = System.currentTimeMillis(); WaitSetEntry entry = (WaitSetEntry) delayQueue.poll(waitTime, MILLISECONDS); if (entry != null) { if (entry.isValid()) { invalidate(entry); } } long end = System.currentTimeMillis(); waitTime -= (end - begin); if (waitTime > FIRST_WAIT_TIME) { waitTime = FIRST_WAIT_TIME; } } for (WaitSet waitSet : waitSetMap.values()) { if (Thread.interrupted()) { return true; } for (WaitSetEntry entry : waitSet) { if (entry.isValid() && entry.needsInvalidation()) { invalidate(entry); } } } return false; }
/** * Invalidates all parked operations for the migrated partition and sends a {@link PartitionMigratingException} as a * response. * Invoked on the migration destination. This is executed under partition migration lock! */ public void onPartitionMigrate(Address thisAddress, MigrationInfo migrationInfo) { Iterator<WaitSetEntry> it = queue.iterator(); int partitionId = migrationInfo.getPartitionId(); while (it.hasNext()) { if (Thread.currentThread().isInterrupted()) { return; } WaitSetEntry entry = it.next(); if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (partitionId == op.getPartitionId()) { entry.setValid(false); PartitionMigratingException pme = new PartitionMigratingException(thisAddress, partitionId, op.getClass().getName(), op.getServiceName()); op.sendResponse(pme); it.remove(); } } }
/** * Invalidates all parked operations for the migrated partition and sends a {@link PartitionMigratingException} as a * response. * Invoked on the migration destination. This is executed under partition migration lock! */ void onPartitionMigrate(MigrationInfo migrationInfo) { Iterator<WaitSetEntry> it = queue.iterator(); int partitionId = migrationInfo.getPartitionId(); while (it.hasNext()) { if (Thread.currentThread().isInterrupted()) { return; } WaitSetEntry entry = it.next(); if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); if (partitionId == op.getPartitionId()) { entry.setValid(false); PartitionMigratingException pme = new PartitionMigratingException(nodeEngine.getThisAddress(), partitionId, op.getClass().getName(), op.getServiceName()); op.sendResponse(pme); it.remove(); } } }
throw new IllegalStateException("Found cyclic wait-notify! -> " + notifier); if (entry.isValid()) { if (entry.isExpired()) {
throw new IllegalStateException("Found cyclic wait-notify! -> " + notifier); if (entry.isValid()) { if (entry.isExpired()) {
public void onShutdown() { Object response = new HazelcastInstanceNotActiveException(); Address thisAddress = nodeEngine.getThisAddress(); for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); // only for local invocations, remote ones will be expired via #onMemberLeft() if (thisAddress.equals(op.getCallerAddress())) { try { OperationResponseHandler responseHandler = op.getOperationResponseHandler(); responseHandler.sendResponse(op, response); } catch (Exception e) { logger.finest("While sending HazelcastInstanceNotActiveException response...", e); } } queue.clear(); } }
public void onShutdown() { Object response = new HazelcastInstanceNotActiveException(); Address thisAddress = nodeEngine.getThisAddress(); for (WaitSetEntry entry : queue) { if (!entry.isValid()) { continue; } Operation op = entry.getOperation(); // only for local invocations, remote ones will be expired via #onMemberLeft() if (thisAddress.equals(op.getCallerAddress())) { try { OperationResponseHandler responseHandler = op.getOperationResponseHandler(); responseHandler.sendResponse(op, response); } catch (Exception e) { logger.finest("While sending HazelcastInstanceNotActiveException response...", e); } } queue.clear(); } }