diff --git a/azkaban-common/src/main/java/azkaban/trigger/TriggerManager.java b/azkaban-common/src/main/java/azkaban/trigger/TriggerManager.java
index 07d1bcc..56637f8 100644
--- a/azkaban-common/src/main/java/azkaban/trigger/TriggerManager.java
+++ b/azkaban-common/src/main/java/azkaban/trigger/TriggerManager.java
@@ -104,7 +104,7 @@ public class TriggerManager extends EventHandler implements
triggerIdMap.put(t.getTriggerId(), t);
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(e);
throw new TriggerManagerException(e);
}
@@ -120,6 +120,7 @@ public class TriggerManager extends EventHandler implements
}
public void insertTrigger(Trigger t) throws TriggerManagerException {
+ logger.info("Inserting trigger " + t + " in TriggerManager");
synchronized (syncObj) {
try {
triggerLoader.addTrigger(t);
@@ -132,6 +133,7 @@ public class TriggerManager extends EventHandler implements
}
public void removeTrigger(int id) throws TriggerManagerException {
+ logger.info("Removing trigger with id: " + id + " from TriggerManager");
synchronized (syncObj) {
Trigger t = triggerIdMap.get(id);
if (t != null) {
@@ -140,24 +142,8 @@ public class TriggerManager extends EventHandler implements
}
}
- public void updateTrigger(int id) throws TriggerManagerException {
- synchronized (syncObj) {
- if (!triggerIdMap.containsKey(id)) {
- throw new TriggerManagerException("The trigger to update " + id
- + " doesn't exist!");
- }
-
- Trigger t;
- try {
- t = triggerLoader.loadTrigger(id);
- } catch (TriggerLoaderException e) {
- throw new TriggerManagerException(e);
- }
- updateTrigger(t);
- }
- }
-
public void updateTrigger(Trigger t) throws TriggerManagerException {
+ logger.info("Updating trigger " + t + " in TriggerManager");
synchronized (syncObj) {
runnerThread.deleteTrigger(triggerIdMap.get(t.getTriggerId()));
runnerThread.addTrigger(t);
@@ -166,6 +152,7 @@ public class TriggerManager extends EventHandler implements
}
public void removeTrigger(Trigger t) throws TriggerManagerException {
+ logger.info("Removing trigger " + t + " from TriggerManager");
synchronized (syncObj) {
runnerThread.deleteTrigger(t);
triggerIdMap.remove(t.getTriggerId());
@@ -264,29 +251,11 @@ public class TriggerManager extends EventHandler implements
}
private void checkAllTriggers() throws TriggerManagerException {
- long now = System.currentTimeMillis();
-
// sweep through the rest of them
for (Trigger t : triggers) {
try {
scannerStage = "Checking for trigger " + t.getTriggerId();
- boolean shouldSkip = true;
- if (shouldSkip && t.getInfo() != null && t.getInfo().containsKey("monitored.finished.execution")) {
- int execId = Integer.valueOf((String) t.getInfo().get("monitored.finished.execution"));
- if (justFinishedFlows.containsKey(execId)) {
- logger.info("Monitored execution has finished. Checking trigger earlier " + t.getTriggerId());
- shouldSkip = false;
- }
- }
- if (shouldSkip && t.getNextCheckTime() > now) {
- shouldSkip = false;
- }
-
- if (shouldSkip) {
- logger.debug("Skipping trigger" + t.getTriggerId() + " until " + t.getNextCheckTime());
- }
-
if (t.getStatus().equals(TriggerStatus.READY)) {
if (t.triggerConditionMet()) {
onTriggerTrigger(t);
@@ -301,7 +270,7 @@ public class TriggerManager extends EventHandler implements
}
} catch (Throwable th) {
//skip this trigger, moving on to the next one
- logger.error("Failed to process trigger with id : " + t.getTriggerId(), th);
+ logger.error("Failed to process trigger with id : " + t, th);
}
}
}
@@ -310,12 +279,12 @@ public class TriggerManager extends EventHandler implements
List<TriggerAction> actions = t.getTriggerActions();
for (TriggerAction action : actions) {
try {
- logger.info("Doing trigger actions");
+ logger.info("Doing trigger actions " + action.getDescription() + " for " + t);
action.doAction();
} catch (Exception e) {
- logger.error("Failed to do action " + action.getDescription(), e);
+ logger.error("Failed to do action " + action.getDescription() + " for " + t, e);
} catch (Throwable th) {
- logger.error("Failed to do action " + action.getDescription(), th);
+ logger.error("Failed to do action " + action.getDescription() + " for " + t, th);
}
}
if (t.isResetOnTrigger()) {
@@ -335,14 +304,12 @@ public class TriggerManager extends EventHandler implements
List<TriggerAction> expireActions = t.getExpireActions();
for (TriggerAction action : expireActions) {
try {
- logger.info("Doing expire actions");
+ logger.info("Doing expire actions for "+ action.getDescription() + " for " + t);
action.doAction();
} catch (Exception e) {
- logger.error("Failed to do expire action " + action.getDescription(),
- e);
+ logger.error("Failed to do expire action " + action.getDescription() + " for " + t, e);
} catch (Throwable th) {
- logger.error("Failed to do expire action " + action.getDescription(),
- th);
+ logger.error("Failed to do expire action " + action.getDescription() + " for " + t, th);
}
}
if (t.isResetOnExpire()) {