public class PNCounterService extends Object implements ManagedService, RemoteService, CRDTReplicationAwareService<PNCounterImpl>, SplitBrainProtectionAwareService, StatisticsAwareService<LocalPNCounterStats>
PNCounter proxies and replication operation.| Modifier and Type | Field and Description |
|---|---|
static String |
SERVICE_NAME
The name under which this service is registered
|
| Constructor and Description |
|---|
PNCounterService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
clearCRDTState(Map<String,VectorClock> vectorClocks)
Removes all of the CRDTs with vector clocks equal to the provided vector
clocks.
|
boolean |
containsCounter(String name)
Returns
true if the CRDT state for the PN counter with the
given name is present on this node. |
PNCounterProxy |
createDistributedObject(String objectName,
boolean local)
Creates a distributed object on the local member only (when
local is
true), else cluster-wide. |
void |
destroyDistributedObject(String objectName,
boolean local)
Destroys a distributed object.
|
PNCounterImpl |
getCounter(String name)
Returns the counter with the given
name. |
LocalPNCounterStatsImpl |
getLocalPNCounterStats(String name)
Returns the PN counter statistics for the counter with the given
name |
String |
getName()
Returns the name of the service
|
String |
getSplitBrainProtectionName(String name)
Gets the name of the split brain protection associated with specified operation name.
|
Map<String,LocalPNCounterStats> |
getStats()
Return the service statistics for the local instance.
|
void |
init(NodeEngine nodeEngine,
Properties properties)
Initializes this service.
|
void |
merge(String name,
PNCounterImpl value)
Performs a merge of the local
name CRDT with the provided state. |
CRDTReplicationContainer |
prepareMigrationOperation(int maxConfiguredReplicaCount)
Returns a migration operation for all of the CRDT states not owned by
this member.
|
CRDTReplicationContainer |
prepareReplicationOperation(Map<String,VectorClock> previouslyReplicatedVectorClocks,
int targetIndex)
Returns a replication operation for the provided vector clocks.
|
void |
prepareToSafeShutdown()
Prepares the service for replication and shutdown.
|
void |
reset()
Resets this service back to its initial state.
|
void |
shutdown(boolean terminate)
Shuts down this service.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDistributedObject, destroyDistributedObjectpublic static final String SERVICE_NAME
public PNCounterImpl getCounter(String name)
name.public boolean containsCounter(String name)
true if the CRDT state for the PN counter with the
given name is present on this node.name - the PN counter namepublic LocalPNCounterStatsImpl getLocalPNCounterStats(String name)
namepublic void init(NodeEngine nodeEngine, Properties properties)
ManagedServiceinit in interface ManagedServicenodeEngine - the NodeEngine that this service belongs toproperties - the Properties (can be used to pass settings to the service)public void reset()
ManagedServiceTODO: what is the purpose of reset
reset in interface ManagedServicepublic void shutdown(boolean terminate)
ManagedServiceTODO: what is the purpose of the terminate variable
shutdown in interface ManagedServiceterminate - true to shut down this servicepublic PNCounterProxy createDistributedObject(String objectName, boolean local)
RemoteServicelocal is
true), else cluster-wide.createDistributedObject in interface RemoteServiceobjectName - the name for the created distributed objectlocal - when true then only perform required proxy creation
actions on the local member, otherwise perform cluster-wide
proxy creation.public void destroyDistributedObject(String objectName, boolean local)
RemoteServicedestroyDistributedObject in interface RemoteServiceobjectName - the name of the distributed object to destroypublic CRDTReplicationContainer prepareReplicationOperation(Map<String,VectorClock> previouslyReplicatedVectorClocks, int targetIndex)
CRDTReplicationAwareServicenull means that there should not be any
replication operation.prepareReplicationOperation in interface CRDTReplicationAwareService<PNCounterImpl>previouslyReplicatedVectorClocks - last successfully replicated vector clocktargetIndex - the index of the replication target in
the membership list containing only data memberspublic String getName()
CRDTReplicationAwareServicegetName in interface CRDTReplicationAwareService<PNCounterImpl>public void merge(String name, PNCounterImpl value)
CRDTReplicationAwareServicename CRDT with the provided state.merge in interface CRDTReplicationAwareService<PNCounterImpl>name - the CRDT namevalue - the CRDT state to merge into the local statepublic CRDTReplicationContainer prepareMigrationOperation(int maxConfiguredReplicaCount)
CRDTReplicationAwareServiceprepareMigrationOperation in interface CRDTReplicationAwareService<PNCounterImpl>maxConfiguredReplicaCount - the maximum configured replica count
for the CRDTs to be migrated (excluding)public boolean clearCRDTState(Map<String,VectorClock> vectorClocks)
CRDTReplicationAwareServiceclearCRDTState in interface CRDTReplicationAwareService<PNCounterImpl>vectorClocks - a map from CRDT name to a vector clocktrue if all of the CRDT states have been cleared,
false otherwisepublic void prepareToSafeShutdown()
CRDTReplicationAwareServiceprepareToSafeShutdown in interface CRDTReplicationAwareService<PNCounterImpl>public String getSplitBrainProtectionName(String name)
SplitBrainProtectionAwareServicegetSplitBrainProtectionName in interface SplitBrainProtectionAwareServicename - the operation name for which the split brain protection name is returnedpublic Map<String,LocalPNCounterStats> getStats()
StatisticsAwareServicegetStats in interface StatisticsAwareService<LocalPNCounterStats>Copyright © 2019 Hazelcast, Inc.. All rights reserved.