use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.
the class AbstractCacheService method cacheEntryListenerRegistered.
public void cacheEntryListenerRegistered(String name, CacheEntryListenerConfiguration cacheEntryListenerConfiguration) {
CacheConfig cacheConfig = getCacheConfig(name);
if (cacheConfig == null) {
throw new IllegalStateException("CacheConfig does not exist for cache " + name);
}
cacheConfig.addCacheEntryListenerConfiguration(cacheEntryListenerConfiguration);
}
use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.
the class HazelcastServerCacheManager method createCacheConfig.
@Override
protected <K, V> CacheConfig<K, V> createCacheConfig(String cacheName, CacheConfig<K, V> config, boolean createAlsoOnOthers, boolean syncCreate) {
CacheConfig<K, V> currentCacheConfig = cacheService.getCacheConfig(cacheName);
OperationService operationService = nodeEngine.getOperationService();
// Create cache config on all nodes.
CacheCreateConfigOperation op = new CacheCreateConfigOperation(config, createAlsoOnOthers);
// Run "CacheCreateConfigOperation" on this node. Its itself handles interaction with other nodes.
// This operation doesn't block operation thread even "syncCreate" is specified.
// In that case, scheduled thread is used, not operation thread.
InternalCompletableFuture future = operationService.invokeOnTarget(CacheService.SERVICE_NAME, op, nodeEngine.getThisAddress());
if (syncCreate) {
return (CacheConfig<K, V>) future.join();
} else {
return currentCacheConfig;
}
}
use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.
the class HazelcastServerCacheManager method getCacheConfig.
@Override
protected <K, V> CacheConfig<K, V> getCacheConfig(String cacheNameWithPrefix, String cacheName) {
CacheGetConfigOperation op = new CacheGetConfigOperation(cacheNameWithPrefix, cacheName);
int partitionId = nodeEngine.getPartitionService().getPartitionId(cacheNameWithPrefix);
InternalCompletableFuture<CacheConfig> f = nodeEngine.getOperationService().invokeOnPartition(CacheService.SERVICE_NAME, op, partitionId);
return f.join();
}
use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.
the class CacheReplicationOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
int confSize = configs.size();
out.writeInt(confSize);
for (CacheConfig config : configs) {
out.writeObject(config);
}
int count = data.size();
out.writeInt(count);
long now = Clock.currentTimeMillis();
for (Map.Entry<String, Map<Data, CacheRecord>> entry : data.entrySet()) {
Map<Data, CacheRecord> cacheMap = entry.getValue();
int subCount = cacheMap.size();
out.writeInt(subCount);
out.writeUTF(entry.getKey());
for (Map.Entry<Data, CacheRecord> e : cacheMap.entrySet()) {
final Data key = e.getKey();
final CacheRecord record = e.getValue();
if (record.isExpiredAt(now)) {
continue;
}
out.writeData(key);
out.writeObject(record);
}
// Empty data will terminate the iteration for read in case
// expired entries were found while serializing, since the
// real subCount will then be different from the one written
// before
out.writeData(null);
}
nearCacheStateHolder.writeData(out);
}
use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.
the class AbstractCacheService method cacheEntryListenerDeregistered.
public void cacheEntryListenerDeregistered(String name, CacheEntryListenerConfiguration cacheEntryListenerConfiguration) {
CacheConfig cacheConfig = getCacheConfig(name);
if (cacheConfig == null) {
throw new IllegalStateException("CacheConfig does not exist for cache " + name);
}
cacheConfig.removeCacheEntryListenerConfiguration(cacheEntryListenerConfiguration);
}
Aggregations