public void updateTrigger(final Trigger t) throws TriggerManagerException { logger.info("Updating trigger " + t + " in TriggerManager"); synchronized (this.syncObj) { this.runnerThread.deleteTrigger(triggerIdMap.get(t.getTriggerId())); this.runnerThread.addTrigger(t); triggerIdMap.put(t.getTriggerId(), t); try { this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } } }
private void onTriggerPause(final Trigger t) throws TriggerManagerException { final List<TriggerAction> expireActions = t.getExpireActions(); for (final TriggerAction action : expireActions) { try { logger.info("Doing expire actions for " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, th); } } logger.info("Pausing Trigger " + t.getDescription()); t.setStatus(TriggerStatus.PAUSED); try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e);
@Test public void testUpdateTrigger() throws Exception { final Trigger t1 = createTrigger("testProj1", "testFlow1", "source1"); t1.setResetOnExpire(true); this.loader.addTrigger(t1); List<Trigger> ts = this.loader.loadTriggers(); assertTrue(ts.get(0).isResetOnExpire() == true); t1.setResetOnExpire(false); this.loader.updateTrigger(t1); ts = this.loader.loadTriggers(); assertTrue(ts.get(0).isResetOnExpire() == false); }
public void updateTrigger(final Trigger t) throws TriggerManagerException { logger.info("Updating trigger " + t + " in TriggerManager"); synchronized (this.syncObj) { this.runnerThread.deleteTrigger(triggerIdMap.get(t.getTriggerId())); this.runnerThread.addTrigger(t); triggerIdMap.put(t.getTriggerId(), t); try { this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } } }
private void onTriggerPause(final Trigger t) throws TriggerManagerException { final List<TriggerAction> expireActions = t.getExpireActions(); for (final TriggerAction action : expireActions) { try { logger.info("Doing expire actions for " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, th); } } logger.info("Pausing Trigger " + t.getDescription()); t.setStatus(TriggerStatus.PAUSED); try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
private void onTriggerTrigger(final Trigger t) throws TriggerManagerException { final List<TriggerAction> actions = t.getTriggerActions(); for (final TriggerAction action : actions) { try { logger.info("Doing trigger actions " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do action " + action.getDescription() + " for " + t, th); } } if (t.isResetOnTrigger()) { t.resetTriggerConditions(); } else { logger.info("NextCheckTime did not change. Setting status to expired for trigger" + t.getTriggerId()); t.setStatus(TriggerStatus.EXPIRED); } try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
private void onTriggerTrigger(Trigger t) throws TriggerManagerException { List<TriggerAction> actions = t.getTriggerActions(); for(TriggerAction action : actions) { try { logger.info("Doing trigger actions"); action.doAction(); } catch (Exception e) { // TODO Auto-generated catch block //throw new TriggerManagerException("action failed to execute", e); logger.error("Failed to do action " + action.getDescription(), e); } catch (Throwable th) { logger.error("Failed to do action " + action.getDescription(), th); } } if(t.isResetOnTrigger()) { t.resetTriggerConditions(); t.resetExpireCondition(); } else { t.setStatus(TriggerStatus.EXPIRED); } try { triggerLoader.updateTrigger(t); } catch (TriggerLoaderException e) { throw new TriggerManagerException(e); } }
private void onTriggerExpire(Trigger t) throws TriggerManagerException { List<TriggerAction> expireActions = t.getExpireActions(); for(TriggerAction action : expireActions) { try { logger.info("Doing expire actions"); action.doAction(); } catch (Exception e) { // TODO Auto-generated catch block //throw new TriggerManagerException("action failed to execute", e); logger.error("Failed to do expire action " + action.getDescription(), e); } catch (Throwable th) { logger.error("Failed to do expire action " + action.getDescription(), th); } } if(t.isResetOnExpire()) { t.resetTriggerConditions(); t.resetExpireCondition(); // updateTrigger(t); } else { t.setStatus(TriggerStatus.EXPIRED); } try { triggerLoader.updateTrigger(t); } catch (TriggerLoaderException e) { throw new TriggerManagerException(e); } }