public class PNCounterService extends Object implements ManagedService, RemoteService, CRDTReplicationAwareService<PNCounterImpl>, QuorumAwareService, StatisticsAwareService<LocalPNCounterStats>
PNCounter proxies and replication operation.| Modifier and Type | Field and Description | 
|---|---|
| static String | SERVICE_NAMEThe 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  trueif the CRDT state for the PN counter with the
 givennameis present on this node. | 
| PNCounterProxy | createDistributedObject(String objectName)Creates a distributed object. | 
| void | destroyDistributedObject(String objectName)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 | getQuorumName(String name)Gets the name of the quorum 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  nameCRDT 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. | 
public 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)
RemoteServicecreateDistributedObject in interface RemoteServiceobjectName - the name for the created distributed objectpublic void destroyDistributedObject(String objectName)
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 getQuorumName(String name)
QuorumAwareServicegetQuorumName in interface QuorumAwareServicename - the operation name for which the quorum name is returedpublic Map<String,LocalPNCounterStats> getStats()
StatisticsAwareServicegetStats in interface StatisticsAwareService<LocalPNCounterStats>Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.