(no commit message)
[utils] / support / general / src / test / java / org / wamblee / test / EventTracker.java
index fce6b23f080ca7694f24a022dac9d70b7790feb3..333da1e78748e36510fd3985535c47caea65ae7a 100644 (file)
@@ -54,9 +54,13 @@ public class EventTracker<Event> {
      * 
      */
     public EventTracker() {
-        _events = new HashMap<Thread, List<Event>>();
+        clear();
     }
 
+       public void clear() {
+               _events = new HashMap<Thread, List<Event>>();
+       }
+
     /**
      * Called by a thread to inform that an event has occurred.
      * 
@@ -127,4 +131,16 @@ public class EventTracker<Event> {
         }
         return count;
     }
+    
+    /**
+     * Gets the total event count over all threads. 
+     * @return
+     */
+    public synchronized int getEventCount() { 
+       int count = 0; 
+       for (Thread thread: _events.keySet()) { 
+               count += _events.get(thread).size();
+       }
+       return count; 
+    }
 }