org.xshare.base.counter
Class CounterFactory

java.lang.Object
  |
  +--org.xshare.base.counter.CounterFactory

public final class CounterFactory
extends java.lang.Object

Factory for the standard implementations of DynamicCounter and StaticCounter with additional helper methods for counters.

Notes On The Implementation

  1. The counters provided by createStaticCounter() and createDynamicCounter() aren't synchronized. If you need a synchronized version of the counters, then create them as usual and pass them to syncStaticCounter(StaticCounter) or syncDynamicCounter(DynamicCounter) and you will get a synchronized version back.

Version:
$Revision: 1.5 $
Author:
Oliver Fischer

Method Summary
static DynamicCounter createDynamicCounter()
          Returns a standard implementation of a DynamicCounter.
static StaticCounter createStaticCounter()
          Returns a standard implementation of a StaticCounter.
static DynamicCounter syncDynamicCounter(DynamicCounter pCounter)
          Wraps a given DynamicCounter with a synchronized wrapper instance.
static StaticCounter syncStaticCounter(StaticCounter pCounter)
          Wraps a given StaticCounter with a synchronized wrapper instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createStaticCounter

public static StaticCounter createStaticCounter()
Returns a standard implementation of a StaticCounter. This standard implementation implements the Serializable interface. If you would like to use this feature, the predicate and the key you would like to pass to StaticCounter.addRule(Object, UnaryPredicate) must be serializable too.


createDynamicCounter

public static DynamicCounter createDynamicCounter()
Returns a standard implementation of a DynamicCounter. This standard implementation implements the Serializable interface. If you would like to use this feature, the UnaryFunction you would like to pass to DynamicCounter.addRule(UnaryFunction) must be serializable too.


syncDynamicCounter

public static DynamicCounter syncDynamicCounter(DynamicCounter pCounter)
Wraps a given DynamicCounter with a synchronized wrapper instance.


syncStaticCounter

public static StaticCounter syncStaticCounter(StaticCounter pCounter)
Wraps a given StaticCounter with a synchronized wrapper instance.



jKiska Base 0.2.1 Release Esche [http://jkiska.sourceforge.net]