public final class PartitionServiceProxy extends Object implements PartitionService
| Constructor and Description |
|---|
PartitionServiceProxy(ClientPartitionService partitionService,
ClientListenerService listenerService) |
| 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
Partitions in the cluster. |
boolean |
isClusterSafe()
Checks whether the cluster is in a safe state.
|
boolean |
isLocalMemberSafe()
Check if the local member is safe to shutdown, meaning check if at least one backup of the partitions
owned by the local member are in sync with primary.
|
boolean |
isMemberSafe(Member member)
Check if the given member is safe to shutdown, meaning check if at least one backup of the partitions
owned by the given member are in sync with primary.
|
String |
randomPartitionKey()
Generates a random partition key.
|
boolean |
removeMigrationListener(String registrationId)
Removes a MigrationListener.
|
boolean |
removePartitionLostListener(String registrationId)
Removes a PartitionLostListener.
|
public PartitionServiceProxy(ClientPartitionService partitionService, ClientListenerService listenerService)
public String randomPartitionKey()
PartitionServicerandomPartitionKey in interface PartitionServicepublic Set<Partition> getPartitions()
PartitionServicePartitions in the cluster.getPartitions in interface PartitionServicepublic Partition getPartition(Object key)
PartitionServicegetPartition in interface PartitionServicekey - the given keypublic String addMigrationListener(MigrationListener migrationListener)
PartitionServicePartitionService.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 PartitionServicemigrationListener - the added MigrationListenerPartitionService.removeMigrationListener(String)public boolean removeMigrationListener(String registrationId)
PartitionServiceremoveMigrationListener in interface PartitionServiceregistrationId - the registration id of the listener to remove.PartitionService.addMigrationListener(MigrationListener)public String addPartitionLostListener(PartitionLostListener partitionLostListener)
PartitionServicePartitionService.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 PartitionServicepartitionLostListener - the added PartitionLostListenerPartitionService.removePartitionLostListener(String)public boolean removePartitionLostListener(String registrationId)
PartitionServiceremovePartitionLostListener in interface PartitionServiceregistrationId - the registration id of the listener to remove.PartitionService.addPartitionLostListener(PartitionLostListener)public boolean isClusterSafe()
PartitionServiceisClusterSafe in interface PartitionServicepublic boolean isMemberSafe(Member member)
PartitionServiceisMemberSafe in interface PartitionServicemember - the cluster member to query.public boolean isLocalMemberSafe()
PartitionServiceisLocalMemberSafe in interface PartitionServicepublic boolean forceLocalMemberToBeSafe(long timeout,
TimeUnit unit)
PartitionServiceforceLocalMemberToBeSafe in interface PartitionServicetimeout - the time limit for checking/syncing with the backupunit - the unit of time for timeoutCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.