|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.oddjob.logging.cache.SimpleCounter
public class SimpleCounter
A counter which counts many things and executes an action when the count of things reaches zero or a thing is first created.
| Constructor Summary | |
|---|---|
SimpleCounter()
|
|
| Method Summary | |
|---|---|
void |
add(Object key)
Add an object to be counted without an action. |
void |
add(Object key,
Runnable newAction)
Add a thing to be counted, and the action to execute if this is the first thing to be counted. |
void |
remove(Object key)
Remove an object taking no action if the count of that object reaches 0. |
void |
remove(Object key,
Runnable emptyAction)
Remove an object from the count. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleCounter()
| Method Detail |
|---|
public void add(Object key)
key - The object to count.
public void add(Object key,
Runnable newAction)
key - The thing to count.newAction - The action to take if this is the first thing.
public void remove(Object key)
throws IllegalStateException
key - The object to remove from the count.
IllegalStateException - If the object was never counted.
public void remove(Object key,
Runnable emptyAction)
throws IllegalStateException
key - The object that will decrement the count.emptyAction - Action to take when the count is 0.
IllegalStateException - If the object was never counted.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||