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
Modifier and Type | Method and Description |
---|---|
String |
addMigrationListener(MigrationListener migrationListener)
Adds a MigrationListener.
|
boolean |
forceLocalMemberToBeSafe(long timeout,
TimeUnit unit)
Force local member to be safe by checking and syncing partitions those owned by local member
with at least one of the backups.
|
Partition |
getPartition(Object key)
Returns partition which 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 local member is safe to shutdown, means check if at least one backup of the partitions
those owned by local member are in sync with primary.
|
boolean |
isMemberSafe(Member member)
Check if the given member is safe to shutdown, means check if at least one backup of the partitions
those owned by given member are in sync with primary.
|
String |
randomPartitionKey()
Generates a random partition key.
|
boolean |
removeMigrationListener(String registrationId)
Removes a MigrationListener.
|
Set<Partition> getPartitions()
Partition
s in the cluster.Partition getPartition(Object key)
key
- keyString 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
- listenerNullPointerException
- 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
- Id of listener registration.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)
boolean isClusterSafe()
true
if there are no partitions being migrated, and there are sufficient backups
for each partition per the configuration, otherwise false
.boolean isMemberSafe(Member member)
member
- Cluster member to query.true
if member in a safe state, other wise false
.boolean isLocalMemberSafe()
boolean forceLocalMemberToBeSafe(long timeout, TimeUnit unit)
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.