public class PersistentConfigDescriptors extends Object
ConfigDescriptors. The names are generated from
the service name and distributed object name and the cache ID is generated by a sequence. Also persists this
information on disk with an additional config per cache descriptor.| Constructor and Description |
|---|
PersistentConfigDescriptors(File instanceHome) |
| Modifier and Type | Method and Description |
|---|---|
void |
backup(File targetDir)
Copies the contents of the persisted cache descriptors to a folder with the name
CONFIG_FOLDER under the
targetDir. |
void |
ensureHas(com.hazelcast.internal.serialization.InternalSerializationService serializationService,
String serviceName,
String name,
Object config)
Ensures that this instance contains mapping for a
ConfigDescriptor. |
ConfigDescriptor |
getDescriptor(long prefix)
Returns the
ConfigDescriptor for the given prefix. |
long |
getPrefix(String serviceName,
String name,
int partitionId)
Returns the prefix for the given parameters.
|
void |
reset() |
static int |
toPartitionId(long prefix)
Returns the partition ID for the
prefix. |
public PersistentConfigDescriptors(File instanceHome)
public void reset()
public long getPrefix(String serviceName, String name, int partitionId)
partitionId.
The cache ID is retrieved from the persisted cache descriptors map by serviceName and name.serviceName - the service namename - the distributed object namepartitionId - the partition IDpublic ConfigDescriptor getDescriptor(long prefix)
ConfigDescriptor for the given prefix. The higher 4 bytes in the prefix should
represent the cache ID.prefix - the prefix for which the ConfigDescriptor is returnedpublic void ensureHas(com.hazelcast.internal.serialization.InternalSerializationService serializationService,
String serviceName,
String name,
Object config)
ConfigDescriptor. If there is no existing
mapping, creates one by assigning it a new ID. It then persists the newly created descriptor on disk.serializationService - the serialization service used for serializing a newly created descriptor to diskserviceName - the name of the service (e.g. ICacheService.SERVICE_NAME or
MapService.SERVICE_NAME)name - the name of the distributed objectconfig - configuration written to disk alongside the newly created descriptorpublic static int toPartitionId(long prefix)
prefix. Currently the lower 4 bytes of the prefix represent the
partition ID.prefix - the prefixpublic void backup(File targetDir)
CONFIG_FOLDER under the
targetDir. This method does not synchronize with the rest of the code so for consistent descriptors it is
necessary to ensure that no cache descriptor changes or additions are in progress.targetDir - the directory under which the folder with the descriptors will be copiedCopyright © 2022 Hazelcast, Inc.. All Rights Reserved.