use of com.hazelcast.cache.impl.operation.CacheCreateConfigOperation 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;
}
}
Aggregations