com.hazelcast.core
public interface PartitionService
Partition
s and attach/detach MigrationListener
s to listen to partition
migration events.
The methods on the PartitionService are thread-safe.Partition
,
MigrationListener
,
PartitionLostListener
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()
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()
Deprecated.
|
boolean |
removeMigrationListener(String registrationId)
Removes a MigrationListener.
|
boolean |
removePartitionLostListener(String registrationId)
Removes a PartitionLostListener.
|
Set<Partition> getPartitions()
Partition
s in the cluster.Partition getPartition(Object key)
key
- the given key@Deprecated String randomPartitionKey()
String addMigrationListener(MigrationListener migrationListener)
removeMigrationListener(String)
method.
There is no check for duplicate registrations, so if you register the listener twice, it will get events twice.migrationListener
- the added MigrationListenerNullPointerException
- if migrationListener is null.UnsupportedOperationException
- if this operation isn't supported. For example on the client side it isn't possible
to add a MigrationListener.removeMigrationListener(String)
boolean removeMigrationListener(String registrationId)
registrationId
- the registration id of the listener to remove.NullPointerException
- if registrationId is null.UnsupportedOperationException
- if this operation isn't supported. For example, on the client side it isn't possible
to add/remove a MigrationListener.addMigrationListener(MigrationListener)
String addPartitionLostListener(PartitionLostListener partitionLostListener)
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 weaknessespartitionLostListener
- the added PartitionLostListenerNullPointerException
- if partitionLostListener is null.removePartitionLostListener(String)
boolean removePartitionLostListener(String registrationId)
registrationId
- the registration id of the listener to remove.NullPointerException
- if registrationId is null.addPartitionLostListener(PartitionLostListener)
boolean isClusterSafe()
boolean isMemberSafe(Member member)
member
- the cluster member to query.boolean isLocalMemberSafe()
boolean forceLocalMemberToBeSafe(long timeout, TimeUnit unit)
timeout
- the time limit for checking/syncing with the backupunit
- the unit of time for timeoutCopyright © 2015 Hazelcast, Inc.. All Rights Reserved.