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()
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(ClientPartitionService partitionService, ClientListenerService listenerService)
public String randomPartitionKey()
PartitionService
The returned value will never be null.
This method is deprecated since Hazelcast 3.5. If you need a random partition-key, you can use e.g.
a random number, random string or UUID for that.
randomPartitionKey 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)
PartitionService
The addMigrationListener returns a register ID. This ID is needed to remove the MigrationListener using the
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 PartitionServicemigrationListener - the added MigrationListenerPartitionService.removeMigrationListener(String)public boolean removeMigrationListener(String registrationId)
PartitionServiceIf the same MigrationListener is registered multiple times, it needs to be removed multiple times.
This method can safely be called multiple times for the same registration ID; every subsequent call is just ignored.
removeMigrationListener in interface PartitionServiceregistrationId - the registration ID of the listener to removetrue if the listener is removed, false otherwisePartitionService.addMigrationListener(MigrationListener)public String addPartitionLostListener(PartitionLostListener partitionLostListener)
PartitionService
The addPartitionLostListener returns a registration ID. This ID is needed to remove the PartitionLostListener using the
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 weaknesses
addPartitionLostListener in interface PartitionServicepartitionLostListener - the added PartitionLostListenerPartitionService.removePartitionLostListener(String)public boolean removePartitionLostListener(String registrationId)
PartitionServiceIf the same PartitionLostListener is registered multiple times, it needs to be removed multiple times.
This method can safely be called multiple times for the same registration ID; every subsequent call is just ignored.
removePartitionLostListener in interface PartitionServiceregistrationId - the registration ID of the listener to removetrue if the listener is removed, false otherwisePartitionService.addPartitionLostListener(PartitionLostListener)public boolean isClusterSafe()
PartitionServiceSafe state means; there are no partitions being migrated and all backups are in sync when this method is called.
isClusterSafe in interface PartitionServicetrue if there are no partitions being migrated and all backups are in sync, false otherwisepublic boolean isMemberSafe(Member member)
PartitionServiceSafe state means; all backups of partitions currently owned by the member are in sync when this method is called.
isMemberSafe in interface PartitionServicemember - the cluster member to querytrue if the member is in a safe state, false otherwisepublic boolean isLocalMemberSafe()
PartitionServiceSafe state means; all backups of partitions currently owned by local member are in sync when this method is called.
isLocalMemberSafe 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 © 2020 Hazelcast, Inc.. All Rights Reserved.