public final class PartitionServiceProxy extends Object implements PartitionService
Constructor and Description |
---|
PartitionServiceProxy(ClientPartitionService partitionService) |
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.
|
public PartitionServiceProxy(ClientPartitionService 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
- 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
- listenerPartitionService.removeMigrationListener(String)
public boolean removeMigrationListener(String registrationId)
PartitionService
removeMigrationListener
in interface PartitionService
registrationId
- Id of listener registration.PartitionService.addMigrationListener(MigrationListener)
public boolean isClusterSafe()
PartitionService
isClusterSafe
in interface PartitionService
true
if there are no partitions being migrated, and there are sufficient backups
for each partition per the configuration, otherwise false
.public boolean isMemberSafe(Member member)
PartitionService
isMemberSafe
in interface PartitionService
member
- Cluster member to query.true
if member in a safe state, other wise false
.public boolean isLocalMemberSafe()
PartitionService
isLocalMemberSafe
in interface PartitionService
public boolean forceLocalMemberToBeSafe(long timeout, TimeUnit unit)
PartitionService
forceLocalMemberToBeSafe
in interface PartitionService
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.