/** @param t */ public static synchronized void remove(Trigger t) { int preSize = TriggerPersistence.size(); try { t.unregister(); list.remove(t); int postSize = TriggerPersistence.size(); if (!(postSize == (preSize - 1))) { LOG.severe("Error while while removing trigger '" + t.getName() + "'"); } } catch (Exception e) { LOG.severe("Error while while unregistering the trigger '" + t.getName() + "'"); } }
/** @param t */ public static synchronized void addAndRegister(Trigger t) { int preSize = TriggerPersistence.size(); if (!list.contains(t)) { list.add(t); t.register(); int postSize = TriggerPersistence.size(); if (!(postSize == (preSize + 1))) { LOG.severe("Error while while adding and registering trigger '" + t.getName() + "'"); } } else { // this trigger is already in the list int old = list.indexOf(t); list.get(old).unregister(); list.set(old, t); t.register(); } }