/** * Cancel cancellable. */ private final void cancelCancellable() { if (timeoutMessageCancellable != null && !timeoutMessageCancellable.isCancelled()) { timeoutMessageCancellable.cancel(); } if (pollMessageCancellable != null && !pollMessageCancellable.isCancelled()) { pollMessageCancellable.cancel(); } }
/** * * 201412: now consider the poller. With poller, will cancel this future * task and reschedule */ private void cancelExistingIfAnyAndScheduleTimeoutCall() { // To handle cases where this operation takes extremely long, schedule a // 'timeout' message to be sent to us if (timeoutMessageCancellable != null && !timeoutMessageCancellable.isCancelled()) { timeoutMessageCancellable.cancel(); } // now reschedule timeoutMessageCancellable = getContext() .system() .scheduler() .scheduleOnce(timeoutDuration, getSelf(), OperationWorkerMsgType.OPERATION_TIMEOUT, getContext().system().dispatcher(), getSelf()); }
private void stopHeartBeat() { if (heartbeatSchedule != null && !heartbeatSchedule.isCancelled()) { heartbeatSchedule.cancel(); } }
/** * Cancel cancellable. */ private final void cancelCancellable() { if (timeoutMessageCancellable != null && !timeoutMessageCancellable.isCancelled()) { timeoutMessageCancellable.cancel(); } if (pollMessageCancellable != null && !pollMessageCancellable.isCancelled()) { pollMessageCancellable.cancel(); } }
private void populateRegistry(String memberName) { String notifier = new StringBuilder().append(NOTIFIER_AKKA_URL).append(memberName) .append("/").append(memberName).append("-notifier").toString(); if (!notifierRegistrationStatus.containsKey(notifier)) { notifierRegistrationStatus.put(notifier, false); } if (!registrationSchedule.isCancelled()) { scheduleRegistrationListener(SCHEDULER_DURATION); } }
private void cancelOwnerSelectionTask(YangInstanceIdentifier entityPath){ final Cancellable lastScheduledTask = entityToScheduledOwnershipTask.get(entityPath); if(lastScheduledTask != null && !lastScheduledTask.isCancelled()){ lastScheduledTask.cancel(); } }
/** * stop the scheduled election */ protected void stopElection() { if (electionCancel != null && !electionCancel.isCancelled()) { electionCancel.cancel(); } }
@Override public void postStop() { if (scheduler != null && !scheduler.isCancelled()) { scheduler.cancel(); scheduler = null; } }
private void populateRegistry(String memberName) { for (String shard: shardsToMonitor) { String notifier =(new StringBuilder()).append(NOTIFIER_AKKA_URL).append(memberName) .append("/").append(memberName).append("-notifier").toString(); if (!notifierRegistrationStatus.containsKey(notifier)) { notifierRegistrationStatus.put(notifier, false); } } if (!registrationSchedule.isCancelled()) { scheduleRegistrationListener(schedulerDuration); } }
@Override public void postStop() { if (scheduler != null && !scheduler.isCancelled()) { scheduler.cancel(); scheduler = null; } }
private void handleRegisterRoleChangeListenerReply(String senderId) { if (notifierRegistrationStatus.containsKey(senderId)) { notifierRegistrationStatus.put(senderId, true); //cancel the schedule when listener is registered with all notifiers if (!registrationSchedule.isCancelled()) { boolean cancelScheduler = true; for (Boolean value : notifierRegistrationStatus.values()) { cancelScheduler = cancelScheduler & value; } if (cancelScheduler) { registrationSchedule.cancel(); } } } else { LOG.info("Unexpected, RegisterRoleChangeListenerReply received from notifier which is not known to Listener:{}", senderId); } }
private void handleRegisterRoleChangeListenerReply(String senderId) { if (notifierRegistrationStatus.containsKey(senderId)) { notifierRegistrationStatus.put(senderId, true); //cancel the schedule when listener is registered with all notifiers if (!registrationSchedule.isCancelled()) { boolean cancelScheduler = true; for (Boolean value : notifierRegistrationStatus.values()) { cancelScheduler = cancelScheduler & value; } if (cancelScheduler) { registrationSchedule.cancel(); } } } else { LOG.info( "Unexpected, RegisterRoleChangeListenerReply received from notifier which is not known to Listener:{}", senderId); } }
@Override public void aroundPostRestart(Throwable reason) { super.aroundPostRestart(reason); if(cancellable == null || cancellable.isCancelled()){ cancellable = startScheduledAwake(); } }
private void onSelectOwner(SelectOwner selectOwner) { LOG.debug("{}: onSelectOwner: {}", persistenceId(), selectOwner); String currentOwner = getCurrentOwner(selectOwner.getEntityPath()); if(Strings.isNullOrEmpty(currentOwner)) { writeNewOwner(selectOwner.getEntityPath(), newOwner(currentOwner, selectOwner.getAllCandidates(), selectOwner.getOwnerSelectionStrategy())); Cancellable cancellable = entityToScheduledOwnershipTask.get(selectOwner.getEntityPath()); if(cancellable != null){ if(!cancellable.isCancelled()){ cancellable.cancel(); } entityToScheduledOwnershipTask.remove(selectOwner.getEntityPath()); } } }
/** * * 201412: now consider the poller. With poller, will cancel this future * task and reschedule */ private void cancelExistingIfAnyAndScheduleTimeoutCall() { // To handle cases where this operation takes extremely long, schedule a // 'timeout' message to be sent to us if (timeoutMessageCancellable != null && !timeoutMessageCancellable.isCancelled()) { timeoutMessageCancellable.cancel(); } // now reschedule timeoutMessageCancellable = getContext() .system() .scheduler() .scheduleOnce(timeoutDuration, getSelf(), OperationWorkerMsgType.OPERATION_TIMEOUT, getContext().system().dispatcher(), getSelf()); }