Add method to remove reactions.
[rhynodge.git] / src / main / java / net / pterodactylus / reactor / engine / Engine.java
index 0fb3f18..7c15e5a 100644 (file)
@@ -78,6 +78,23 @@ public class Engine extends AbstractExecutionThreadService {
                }
        }
 
+       /**
+        * Removes the reaction with the given name.
+        *
+        * @param name
+        *            The name of the reaction to remove
+        */
+       public void removeReaction(String name) {
+               synchronized (reactions) {
+                       if (!reactions.containsKey(name)) {
+                               return;
+                       }
+                       Reaction reaction = reactions.remove(name);
+                       reactionExecutions.remove(reaction);
+                       reactions.notifyAll();
+               }
+       }
+
        //
        // ABSTRACTSERVICE METHODS
        //