public class PartitionServiceProxy extends Object implements PartitionService
Constructor and Description |
---|
PartitionServiceProxy(NodeEngineImpl nodeEngine,
InternalPartitionServiceImpl partitionService) |
Modifier and Type | Method and Description |
---|---|
String |
addMigrationListener(MigrationListener migrationListener)
Adds a MigrationListener.
|
String |
addPartitionLostListener(PartitionLostListener partitionLostListener)
Adds a PartitionLostListener.
|
boolean |
forceLocalMemberToBeSafe(long timeout,
TimeUnit unit)
Force the local member to be safe by checking and syncing partitions owned by the local member
with at least one of the backups.
|
Partition |
getPartition(Object key)
Returns the partition that the given key belongs to.
|
Set<Partition> |
getPartitions()
Returns a set containing all the
Partition s in the cluster. |
boolean |
isClusterSafe()
Checks whether the cluster is in a safe state.
|
boolean |
isLocalMemberSafe()
Checks whether local member is in safe state.
|
boolean |
isMemberSafe(Member member)
Checks whether the given member is in safe state.
|
String |
randomPartitionKey()
Generates a random partition key.
|
boolean |
removeMigrationListener(String registrationId)
Removes a MigrationListener.
|
boolean |
removePartitionLostListener(String registrationId)
Removes a PartitionLostListener.
|
public PartitionServiceProxy(NodeEngineImpl nodeEngine, InternalPartitionServiceImpl partitionService)
public String randomPartitionKey()
PartitionService
randomPartitionKey
in interface PartitionService
public Set<Partition> getPartitions()
PartitionService
Partition
s in the cluster.getPartitions
in interface PartitionService
public Partition getPartition(Object key)
PartitionService
getPartition
in interface PartitionService
key
- the given keypublic String addMigrationListener(MigrationListener migrationListener)
PartitionService
PartitionService.removeMigrationListener(String)
method.
There is no check for duplicate registrations, so if you register the listener twice, it will get events twice.addMigrationListener
in interface PartitionService
migrationListener
- the added MigrationListenerPartitionService.removeMigrationListener(String)
public boolean removeMigrationListener(String registrationId)
PartitionService
removeMigrationListener
in interface PartitionService
registrationId
- the registration id of the listener to remove.PartitionService.addMigrationListener(MigrationListener)
public String addPartitionLostListener(PartitionLostListener partitionLostListener)
PartitionService
PartitionService.removePartitionLostListener(String)
method.
There is no check for duplicate registrations, so if you register the listener twice, it will get events twice.
IMPORTANT: Please @see com.hazelcast.partition.PartitionLostListener for weaknessesaddPartitionLostListener
in interface PartitionService
partitionLostListener
- the added PartitionLostListenerPartitionService.removePartitionLostListener(String)
public boolean removePartitionLostListener(String registrationId)
PartitionService
removePartitionLostListener
in interface PartitionService
registrationId
- the registration id of the listener to remove.PartitionService.addPartitionLostListener(PartitionLostListener)
public boolean isClusterSafe()
PartitionService
isClusterSafe
in interface PartitionService
public boolean isMemberSafe(Member member)
PartitionService
isMemberSafe
in interface PartitionService
member
- the cluster member to query.public boolean isLocalMemberSafe()
PartitionService
isLocalMemberSafe
in interface PartitionService
public boolean forceLocalMemberToBeSafe(long timeout, TimeUnit unit)
PartitionService
forceLocalMemberToBeSafe
in interface PartitionService
timeout
- the time limit for checking/syncing with the backupunit
- the unit of time for timeoutCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.