com.hazelcast.cache.impl
Class AbstractCacheService

java.lang.Object
  extended by com.hazelcast.cache.impl.AbstractCacheService
All Implemented Interfaces:
ICacheService, EventPublishingService<Object,CacheEventListener>, ManagedService, MigrationAwareService, RemoteService
Direct Known Subclasses:
CacheService

public abstract class AbstractCacheService
extends Object
implements ICacheService


Field Summary
protected  ConstructorFunction<String,CacheStatisticsImpl> cacheStatisticsConstructorFunction
           
protected  ConcurrentMap<String,CacheConfig> configs
           
protected  NodeEngine nodeEngine
           
protected  ConcurrentMap<String,CacheOperationProvider> operationProviderCache
           
protected  CachePartitionSegment[] segments
           
protected  ConcurrentMap<String,CacheStatisticsImpl> statistics
           
 
Fields inherited from interface com.hazelcast.cache.impl.ICacheService
SERVICE_NAME
 
Constructor Summary
AbstractCacheService()
           
 
Method Summary
 void beforeMigration(PartitionMigrationEvent event)
           
 void clearPartitionReplica(int partitionId)
           
 void commitMigration(PartitionMigrationEvent event)
           
 CacheConfig createCacheConfigIfAbsent(CacheConfig config)
           
 CacheStatisticsImpl createCacheStatIfAbsent(String name)
           
 DistributedObject createDistributedObject(String objectName)
           
protected abstract  ICacheRecordStore createNewRecordStore(String name, int partitionId)
           
 CacheConfig deleteCacheConfig(String name)
           
 void deleteCacheStat(String name)
           
 void deregisterAllListener(String name)
           
 boolean deregisterListener(String name, String registrationId)
           
 void destroyCache(String objectName, boolean isLocal, String callerUuid)
           
protected  void destroyCacheOnAllMembers(String objectName, String callerUuid)
           
 void destroyDistributedObject(String objectName)
           
protected  void destroySegments(String objectName)
           
 void dispatchEvent(Object event, CacheEventListener listener)
           
 CacheSimpleConfig findCacheConfig(String simpleName)
           
 CacheConfig getCacheConfig(String name)
           
protected
<K,V> CacheConfig<K,V>
getCacheConfigFromPartition(String cacheNameWithPrefix, String cacheName)
           
 Collection<CacheConfig> getCacheConfigs()
           
 CacheOperationProvider getCacheOperationProvider(String nameWithPrefix, InMemoryFormat inMemoryFormat)
          Creates cache operations according to the storage-type of the cache
 ICacheRecordStore getCacheRecordStore(String name, int partitionId)
           
 NodeEngine getNodeEngine()
           
 ICacheRecordStore getOrCreateCache(String name, int partitionId)
           
 CachePartitionSegment getSegment(int partitionId)
           
 CacheStatisticsImpl getStatistics(String name)
           
 void init(NodeEngine nodeEngine, Properties properties)
          Initializes this ManagedService
 void publishEvent(String cacheName, CacheEventSet eventSet, int orderKey)
           
 void publishEvent(String cacheName, CacheEventType eventType, Data dataKey, Data dataValue, Data dataOldValue, boolean isOldValueAvailable, int orderKey, int completionId)
           
 String registerListener(String distributedObjectName, CacheEventListener listener)
           
 void rollbackMigration(PartitionMigrationEvent event)
           
 void setManagementEnabled(CacheConfig cacheConfig, String cacheNameWithPrefix, boolean enabled)
           
 void setStatisticsEnabled(CacheConfig cacheConfig, String cacheNameWithPrefix, boolean enabled)
           
 Data toData(Object object)
           
 Object toObject(Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hazelcast.spi.ManagedService
reset, shutdown
 
Methods inherited from interface com.hazelcast.spi.MigrationAwareService
prepareReplicationOperation
 

Field Detail

configs

protected final ConcurrentMap<String,CacheConfig> configs

statistics

protected final ConcurrentMap<String,CacheStatisticsImpl> statistics

operationProviderCache

protected final ConcurrentMap<String,CacheOperationProvider> operationProviderCache

cacheStatisticsConstructorFunction

protected final ConstructorFunction<String,CacheStatisticsImpl> cacheStatisticsConstructorFunction

nodeEngine

protected NodeEngine nodeEngine

segments

protected CachePartitionSegment[] segments
Constructor Detail

AbstractCacheService

public AbstractCacheService()
Method Detail

init

public final void init(NodeEngine nodeEngine,
                       Properties properties)
Description copied from interface: ManagedService
Initializes this ManagedService

Specified by:
init in interface ManagedService
Parameters:
nodeEngine - the NodeEngine this ManagedService belongs to.
properties - the Properties. Can be used to pass settings to the service.

createNewRecordStore

protected abstract ICacheRecordStore createNewRecordStore(String name,
                                                          int partitionId)

createDistributedObject

public DistributedObject createDistributedObject(String objectName)
Specified by:
createDistributedObject in interface RemoteService

destroyDistributedObject

public void destroyDistributedObject(String objectName)
Specified by:
destroyDistributedObject in interface RemoteService

beforeMigration

public void beforeMigration(PartitionMigrationEvent event)
Specified by:
beforeMigration in interface MigrationAwareService

commitMigration

public void commitMigration(PartitionMigrationEvent event)
Specified by:
commitMigration in interface MigrationAwareService

rollbackMigration

public void rollbackMigration(PartitionMigrationEvent event)
Specified by:
rollbackMigration in interface MigrationAwareService

clearPartitionReplica

public void clearPartitionReplica(int partitionId)
Specified by:
clearPartitionReplica in interface MigrationAwareService

getOrCreateCache

public ICacheRecordStore getOrCreateCache(String name,
                                          int partitionId)
Specified by:
getOrCreateCache in interface ICacheService

getCacheRecordStore

public ICacheRecordStore getCacheRecordStore(String name,
                                             int partitionId)
Specified by:
getCacheRecordStore in interface ICacheService

getSegment

public CachePartitionSegment getSegment(int partitionId)
Specified by:
getSegment in interface ICacheService

destroySegments

protected void destroySegments(String objectName)

destroyCache

public void destroyCache(String objectName,
                         boolean isLocal,
                         String callerUuid)
Specified by:
destroyCache in interface ICacheService

destroyCacheOnAllMembers

protected void destroyCacheOnAllMembers(String objectName,
                                        String callerUuid)

createCacheConfigIfAbsent

public CacheConfig createCacheConfigIfAbsent(CacheConfig config)
Specified by:
createCacheConfigIfAbsent in interface ICacheService

deleteCacheConfig

public CacheConfig deleteCacheConfig(String name)
Specified by:
deleteCacheConfig in interface ICacheService

createCacheStatIfAbsent

public CacheStatisticsImpl createCacheStatIfAbsent(String name)
Specified by:
createCacheStatIfAbsent in interface ICacheService

deleteCacheStat

public void deleteCacheStat(String name)
Specified by:
deleteCacheStat in interface ICacheService

setStatisticsEnabled

public void setStatisticsEnabled(CacheConfig cacheConfig,
                                 String cacheNameWithPrefix,
                                 boolean enabled)
Specified by:
setStatisticsEnabled in interface ICacheService

setManagementEnabled

public void setManagementEnabled(CacheConfig cacheConfig,
                                 String cacheNameWithPrefix,
                                 boolean enabled)
Specified by:
setManagementEnabled in interface ICacheService

getCacheConfig

public CacheConfig getCacheConfig(String name)
Specified by:
getCacheConfig in interface ICacheService

findCacheConfig

public CacheSimpleConfig findCacheConfig(String simpleName)
Specified by:
findCacheConfig in interface ICacheService

getCacheConfigFromPartition

protected <K,V> CacheConfig<K,V> getCacheConfigFromPartition(String cacheNameWithPrefix,
                                                             String cacheName)

getCacheConfigs

public Collection<CacheConfig> getCacheConfigs()
Specified by:
getCacheConfigs in interface ICacheService

toObject

public Object toObject(Object data)

toData

public Data toData(Object object)

publishEvent

public void publishEvent(String cacheName,
                         CacheEventType eventType,
                         Data dataKey,
                         Data dataValue,
                         Data dataOldValue,
                         boolean isOldValueAvailable,
                         int orderKey,
                         int completionId)
Specified by:
publishEvent in interface ICacheService

publishEvent

public void publishEvent(String cacheName,
                         CacheEventSet eventSet,
                         int orderKey)
Specified by:
publishEvent in interface ICacheService

getNodeEngine

public NodeEngine getNodeEngine()
Specified by:
getNodeEngine in interface ICacheService

dispatchEvent

public void dispatchEvent(Object event,
                          CacheEventListener listener)
Specified by:
dispatchEvent in interface EventPublishingService<Object,CacheEventListener>

registerListener

public String registerListener(String distributedObjectName,
                               CacheEventListener listener)
Specified by:
registerListener in interface ICacheService

deregisterListener

public boolean deregisterListener(String name,
                                  String registrationId)
Specified by:
deregisterListener in interface ICacheService

deregisterAllListener

public void deregisterAllListener(String name)
Specified by:
deregisterAllListener in interface ICacheService

getStatistics

public CacheStatisticsImpl getStatistics(String name)
Specified by:
getStatistics in interface ICacheService

getCacheOperationProvider

public CacheOperationProvider getCacheOperationProvider(String nameWithPrefix,
                                                        InMemoryFormat inMemoryFormat)
Description copied from interface: ICacheService
Creates cache operations according to the storage-type of the cache

Specified by:
getCacheOperationProvider in interface ICacheService


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.