if (somethingExpired) { Iterator iter = monitoredActions.values().iterator(); while (iter.hasNext()) { ActionTimeoutAlarm thisAlarm = (ActionTimeoutAlarm)iter.next(); thisAlarm.handleExpiration(); } } somethingExpired = false;
    protected void execute() {        //***************************************************SelectedActions        //Handle the addition of new ActionPatience for SelectedActions        for ( Iterator iter = monitoredActionsSubscription.getAddedCollection().iterator();            iter.hasNext() ; )         {            ActionPatience ap = (ActionPatience)iter.next();            //findDesiredOutcomes(ap);            startTimerIfNone(ap);         }        // Watches for desirable outcomes for Actions        for ( Iterator iter = actionsWrapperSubscription.getChangedCollection().iterator();            iter.hasNext() ; )         {            ActionsWrapper aw = (ActionsWrapper)iter.next();            Action action = aw.getAction();            ActionRecord latestResult = action.getValue();            ActionTimeoutAlarm alarm = (ActionTimeoutAlarm)monitoredActions.get(action);            ActionPatience ap = findActionPatience(action);            if (alarm != null) { // This is an Action change that we are monitoring (it could be an Action change we are not monitoring)                if (logger.isDebugEnabled()) logger.debug(action.toString());                if (logger.isDebugEnabled()) if (ap != null) logger.debug(ap.toString()); else logger.debug("No ActionPatience Found");                if (latestResult != null &&                      // null when action is not started                    latestResult.getCompletionCode() != null) {  // null when action is not stopped                    if ((latestResult.getCompletionCode().equals(Action.COMPLETED)) // make sure it completed correctly                     && (latestResult.getStartTime() >= ap.getStartTime()))        // make sure it's a current action                        {                            if (logger.isDebugEnabled()) logger.debug(monitoredActions.toString());                            monitoredActions.remove(action);                            ap.setResult(Action.COMPLETED);                            SuccessfulAction sa = new SuccessfulAction(action);                            publishChange(sa);                            if (logger.isDebugEnabled()) logger.debug("Published a SuccessfulAction object: " + sa.toString());                            publishChange(ap);                            alarm.cancel();                        }                    }            }        }    }