public class CacheService extends AbstractCacheService
This service is responsible for:
CacheRecordStore.ICache.MigrationAwareService.WARNING:This service is an optionally registered service which is enabled when JCache
is located on the classpath, as determined by JCacheDetector.isJCacheAvailable(ClassLoader).
If registered, it will provide all the above cache operations for all partitions of the node which it is registered on.
Distributed Cache Name is used for providing a unique name to a cache object to overcome cache manager
scoping which depends on URI and class loader parameters. It's a simple concatenation of CacheNamePrefix and
cache name where CacheNamePrefix is calculated by each cache manager
using AbstractHazelcastCacheManager.getCacheNamePrefix().
cacheContexts, cacheContextsConstructorFunction, cacheEventHandler, cacheResourcesConstructorFunction, cacheResourcesMutexFactory, cacheStatisticsConstructorFunction, clearExpiredRecordsTask, closeableListeners, configs, eventJournal, expirationManager, logger, mergePolicyProvider, nodeEngine, operationProviderCache, resources, segments, splitBrainHandlerService, statistics, TENANT_CONTROL_FACTORYCACHE_SUPPORT_NOT_AVAILABLE_ERROR_MESSAGE, MAX_ADD_CACHE_CONFIG_RETRIES, SERVICE_NAME| Constructor and Description |
|---|
CacheService() |
| Modifier and Type | Method and Description |
|---|---|
void |
commitMigration(PartitionMigrationEvent event)
Commits the migration process for this service, on both source and destination members.
|
protected ICacheRecordStore |
createNewRecordStore(String cacheNameWithPrefix,
int partitionId) |
protected CacheOperationProvider |
createOperationProvider(String nameWithPrefix,
InMemoryFormat inMemoryFormat) |
Collection<ServiceNamespace> |
getAllServiceNamespaces(PartitionReplicationEvent event)
Returns all known namespaces for given replication event.
|
CacheWanEventPublisher |
getCacheWanEventPublisher()
Returns the WAN event publisher responsible for publishing
primary and backup WAN events for caches.
|
static ObjectNamespace |
getObjectNamespace(String cacheName) |
boolean |
isKnownServiceNamespace(ServiceNamespace namespace)
Returns true if namespace is known by this service, false otherwise
|
boolean |
isWanReplicationEnabled(String cacheNameWithPrefix)
Returns
true if WAN replication is enabled for the cache named cacheNameWithPrefix. |
protected CacheReplicationOperation |
newCacheReplicationOperation() |
protected CachePartitionSegment |
newPartitionSegment(int partitionId) |
Operation |
prepareReplicationOperation(PartitionReplicationEvent event)
Returns an operation to replicate service data and/or state for a specific partition replica
on another cluster member.
|
Operation |
prepareReplicationOperation(PartitionReplicationEvent event,
Collection<ServiceNamespace> namespaces)
Returns an operation to replicate service data and/or state for a specific partition replica and namespaces
on another cluster member.
|
void |
rollbackMigration(PartitionMigrationEvent event)
Rollback the migration process for this service, on both source and destination members.
|
String |
toString() |
addCacheResource, addInvalidationListener, beforeMigration, cacheEntryListenerDeregistered, cacheEntryListenerRegistered, closeSegments, createCacheConfigOnAllMembers, createCacheConfigOnAllMembersAsync, createCacheStatIfAbsent, createDistributedObject, deleteCache, deleteCacheConfig, deleteCacheResources, deleteCacheStat, deregisterAllListener, deregisterListener, destroyDistributedObject, destroySegments, dispatchEvent, findCacheConfig, getCacheConfig, getCacheConfigs, getCacheContext, getCacheEventHandler, getCacheOperationProvider, getConfigs, getEventJournal, getExpirationManager, getMergePolicy, getMergePolicyProvider, getNodeEngine, getOrCreateCacheContext, getOrCreateRecordStore, getPartitionSegments, getPreJoinOperation, getQuorumName, getRecordStore, getSegment, getStatistics, init, onClusterStateChange, onPartitionLost, postInit, prepareMergeRunnable, publishCachePartitionLostEvent, publishEvent, publishEvent, putCacheConfigIfAbsent, registerListener, registerListener, registerListenerInternal, reset, sendInvalidationEvent, setManagementEnabled, setStatisticsEnabled, setTenantControl, shutdown, toData, toObjectprotected CachePartitionSegment newPartitionSegment(int partitionId)
newPartitionSegment in class AbstractCacheServiceprotected ICacheRecordStore createNewRecordStore(String cacheNameWithPrefix, int partitionId)
createNewRecordStore in class AbstractCacheServiceprotected CacheOperationProvider createOperationProvider(String nameWithPrefix, InMemoryFormat inMemoryFormat)
createOperationProvider in class AbstractCacheServicepublic Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event)
FragmentedMigrationAwareServiceevent - replication eventpublic boolean isKnownServiceNamespace(ServiceNamespace namespace)
FragmentedMigrationAwareServicenamespace - namespacepublic Operation prepareReplicationOperation(PartitionReplicationEvent event)
MigrationAwareServiceThis method will be called on source member whenever partitioning system requires to copy/replicate a partition replica. Returned operation will be executed on destination member. If operation fails by throwing exception, migration process will fail and will be rolled back.
Returning null is allowed and means service does not have anything to replicate.
event - replicationpublic Operation prepareReplicationOperation(PartitionReplicationEvent event, Collection<ServiceNamespace> namespaces)
FragmentedMigrationAwareServiceMigrationAwareService.prepareReplicationOperation(PartitionReplicationEvent),
instead of copying whole partition replica, allows copying only some portion of replica,
specified by given namespaces.
This method will be called on source member whenever partitioning system requires to copy/replicate a partition replica. Returned operation will be executed on destination member. If operation fails by throwing exception, migration process will fail and will be rolled back.
Returning null is allowed and means service does not have anything to replicate.
event - replication eventnamespaces - replica fragment namespaces to replicateMigrationAwareService.prepareReplicationOperation(PartitionReplicationEvent)protected CacheReplicationOperation newCacheReplicationOperation()
public void commitMigration(PartitionMigrationEvent event)
MigrationAwareServiceCommit is not expected to fail at this point, all exceptions will be suppressed and logged. Implementations of this method must be thread safe as this method may be called concurrently for different migrations on different partitions.
commitMigration in interface MigrationAwareServicecommitMigration in class AbstractCacheServiceevent - migration eventpublic void rollbackMigration(PartitionMigrationEvent event)
MigrationAwareServiceRollback is not expected to fail at this point, all exceptions will be suppressed and logged. Implementations of this method must be thread safe as this method may be called concurrently for different migrations on different partitions.
rollbackMigration in interface MigrationAwareServicerollbackMigration in class AbstractCacheServiceevent - migration eventpublic boolean isWanReplicationEnabled(String cacheNameWithPrefix)
ICacheServicetrue if WAN replication is enabled for the cache named cacheNameWithPrefix.cacheNameWithPrefix - the full name of the ICache, including the manager scope prefixpublic CacheWanEventPublisher getCacheWanEventPublisher()
ICacheServicepublic static ObjectNamespace getObjectNamespace(String cacheName)
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.