@Override public synchronized void Cleanup(MqttMessagingProvider mq) { if (this.hasChildren()) { synchronized (Task.Lock) { for (Node n : children) { if (n != null) { if (n.IsComplete()) { children.remove(n); mq.PublishMessage( new SchedulingEvent( TaskIssuer.TaskIssuerName, SchedulingCommandType.TASKCOMPLETED, new SchedulingEventParams().AddTaskName(n.getLabel()))); } else { if (n.IsTask()) { n.Cleanup(mq); if (n.IsComplete()) // Recheck after cleanup { children.remove(n); mq.PublishMessage( new SchedulingEvent( TaskIssuer.TaskIssuerName, SchedulingCommandType.TASKCOMPLETED, new SchedulingEventParams().AddTaskName(n.getLabel()))); } } } } } } } }
private void ReIssueIfNecessary() { if (this.recurring) { Main.Message(debugFlag, "Reissuing recurring task " + this.label); MqttMessagingProvider mq = MqttMessagingProvider.GetMqttProvider(); mq.PublishMessage(this.agent.getName() + ",ASSIGNTASK,::::" + this.label); } }