git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
found an error in the junit test after a long time
[utils]
/
support
/
general
/
src
/
test
/
java
/
org
/
wamblee
/
test
/
EventTracker.java
diff --git
a/support/general/src/test/java/org/wamblee/test/EventTracker.java
b/support/general/src/test/java/org/wamblee/test/EventTracker.java
index fce6b23f080ca7694f24a022dac9d70b7790feb3..333da1e78748e36510fd3985535c47caea65ae7a 100644
(file)
--- a/
support/general/src/test/java/org/wamblee/test/EventTracker.java
+++ b/
support/general/src/test/java/org/wamblee/test/EventTracker.java
@@
-54,9
+54,13
@@
public class EventTracker<Event> {
*
*/
public EventTracker() {
*
*/
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.
*
/**
* Called by a thread to inform that an event has occurred.
*
@@
-127,4
+131,16
@@
public class EventTracker<Event> {
}
return count;
}
}
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;
+ }
}
}