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_NAME
The name under which this service is registered
|
Constructor and Description |
---|
PNCounterService() |
Modifier and Type | Method and Description |
---|---|
boolean |
clearCRDTState(Map<String,com.hazelcast.cluster.impl.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)
Creates a distributed object.
|
void |
destroyDistributedObject(String objectName)
Destroys a distributed object.
|
PNCounterImpl |
getCounter(String name)
Returns the counter with the given
name . |
com.hazelcast.monitor.impl.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
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,com.hazelcast.cluster.impl.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 com.hazelcast.monitor.impl.LocalPNCounterStatsImpl getLocalPNCounterStats(String name)
name
public void init(NodeEngine nodeEngine, Properties properties)
ManagedService
init
in interface ManagedService
nodeEngine
- the NodeEngine that this service belongs toproperties
- the Properties (can be used to pass settings to the service)public void reset()
ManagedService
TODO: what is the purpose of reset
reset
in interface ManagedService
public void shutdown(boolean terminate)
ManagedService
TODO: what is the purpose of the terminate variable
shutdown
in interface ManagedService
terminate
- true
to shut down this servicepublic PNCounterProxy createDistributedObject(String objectName)
RemoteService
createDistributedObject
in interface RemoteService
objectName
- the name for the created distributed objectpublic void destroyDistributedObject(String objectName)
RemoteService
destroyDistributedObject
in interface RemoteService
objectName
- the name of the distributed object to destroypublic CRDTReplicationContainer prepareReplicationOperation(Map<String,com.hazelcast.cluster.impl.VectorClock> previouslyReplicatedVectorClocks, int targetIndex)
CRDTReplicationAwareService
null
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()
CRDTReplicationAwareService
getName
in interface CRDTReplicationAwareService<PNCounterImpl>
public void merge(String name, PNCounterImpl value)
CRDTReplicationAwareService
name
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)
CRDTReplicationAwareService
prepareMigrationOperation
in interface CRDTReplicationAwareService<PNCounterImpl>
maxConfiguredReplicaCount
- the maximum configured replica count
for the CRDTs to be migrated (excluding)public boolean clearCRDTState(Map<String,com.hazelcast.cluster.impl.VectorClock> vectorClocks)
CRDTReplicationAwareService
clearCRDTState
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()
CRDTReplicationAwareService
prepareToSafeShutdown
in interface CRDTReplicationAwareService<PNCounterImpl>
public String getQuorumName(String name)
QuorumAwareService
getQuorumName
in interface QuorumAwareService
name
- the operation name for which the quorum name is returedpublic Map<String,LocalPNCounterStats> getStats()
StatisticsAwareService
getStats
in interface StatisticsAwareService<LocalPNCounterStats>
Copyright © 2018 Hazelcast, Inc.. All rights reserved.