Package org.jgroups.blocks.atomic
Class CounterService
java.lang.Object
org.jgroups.blocks.atomic.CounterService
Provides a distributed counter (similar to AtomicLong) which can be atomically updated across a cluster.
- Since:
- 3.0.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCounter(String name) Deletes a counter instance (on the coordinator)getOrCreateAsyncCounter(String name, long initial_value) Returns an existing counter, or creates a new one if none existsgetOrCreateCounter(String name, long initial_value) Deprecated.since 5.2.getOrCreateSyncCounter(String name, long initial_value) voidsetChannel(JChannel ch)
-
Field Details
-
counter_prot
-
-
Constructor Details
-
CounterService
-
-
Method Details
-
setChannel
-
getOrCreateCounter
Deprecated.since 5.2. UsegetOrCreateSyncCounter(String, long)instead.Returns an existing counter, or creates a new one if none exists- Parameters:
name- Name of the counter, different counters have to have different namesinitial_value- The initial value of a new counter if there is no existing counter. Ignored if the counter already exists- Returns:
- The counter implementation
-
getOrCreateSyncCounter
-
getOrCreateAsyncCounter
Returns an existing counter, or creates a new one if none exists- Parameters:
name- Name of the counter, different counters have to have different namesinitial_value- The initial value of a new counter if there is no existing counter. Ignored if the counter already exists- Returns:
- A
CompletionStagewhich is completed with the counter implementation.
-
deleteCounter
Deletes a counter instance (on the coordinator)- Parameters:
name- The name of the counter. No-op if the counter doesn't exist
-
printCounters
-
dumpPendingRequests
-