use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class MultiMapPartitionContainer method clearLockStore.
private void clearLockStore(String name) {
NodeEngine nodeEngine = service.getNodeEngine();
LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
DefaultObjectNamespace namespace = new DefaultObjectNamespace(MultiMapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxySupport method keySetInternal.
protected Set<Data> keySetInternal() {
final NodeEngine nodeEngine = getNodeEngine();
try {
Map<Integer, Object> results = nodeEngine.getOperationService().invokeOnAllPartitions(MultiMapService.SERVICE_NAME, new MultiMapOperationFactory(name, OperationFactoryType.KEY_SET));
Set<Data> keySet = new HashSet<Data>();
for (Object result : results.values()) {
if (result == null) {
continue;
}
MultiMapResponse response = nodeEngine.toObject(result);
if (response.getCollection() != null) {
keySet.addAll(response.getCollection());
}
}
return keySet;
} catch (Throwable throwable) {
throw ExceptionUtil.rethrow(throwable);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxySupport method invoke.
private <T> T invoke(Operation operation, Data dataKey) {
final NodeEngine nodeEngine = getNodeEngine();
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(dataKey);
Future f;
Object o;
if (config.isStatisticsEnabled()) {
long time = System.currentTimeMillis();
f = nodeEngine.getOperationService().invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
o = f.get();
if (operation instanceof PutOperation) {
//TODO @ali should we remove statics from operations ?
getService().getLocalMultiMapStatsImpl(name).incrementPuts(System.currentTimeMillis() - time);
} else if (operation instanceof RemoveOperation || operation instanceof RemoveAllOperation) {
getService().getLocalMultiMapStatsImpl(name).incrementRemoves(System.currentTimeMillis() - time);
} else if (operation instanceof GetAllOperation) {
getService().getLocalMultiMapStatsImpl(name).incrementGets(System.currentTimeMillis() - time);
}
} else {
f = nodeEngine.getOperationService().invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
o = f.get();
}
return nodeEngine.toObject(o);
} catch (Throwable throwable) {
throw ExceptionUtil.rethrow(throwable);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method containsKey.
@Override
public boolean containsKey(K key) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
final NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
return containsInternal(dataKey, null);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method entrySet.
@Override
public Set<Map.Entry<K, V>> entrySet() {
final NodeEngine nodeEngine = getNodeEngine();
Map map = entrySetInternal();
Set<Map.Entry<K, V>> entrySet = new HashSet<Map.Entry<K, V>>();
for (Object obj : map.values()) {
if (obj == null) {
continue;
}
EntrySetResponse response = nodeEngine.toObject(obj);
Set<Map.Entry<K, V>> entries = response.getObjectEntrySet(nodeEngine);
entrySet.addAll(entries);
}
return entrySet;
}
Aggregations