use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method put.
@Override
public boolean put(K key, V value) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED);
final NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
Data dataValue = nodeEngine.toData(value);
return putInternal(dataKey, dataValue, -1);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method tryLock.
@Override
public boolean tryLock(K key) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
return lockSupport.tryLock(nodeEngine, dataKey);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class DefaultRecordStore method clearPartition.
@Override
public void clearPartition(boolean onShutdown) {
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
final DefaultObjectNamespace namespace = new DefaultObjectNamespace(MapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
Indexes indexes = mapContainer.getIndexes();
if (indexes.hasIndex()) {
for (Record record : storage.values()) {
Data key = record.getKey();
Object value = Records.getValueOrCachedValue(record, serializationService);
indexes.removeEntryIndex(key, value);
}
}
mapDataStore.reset();
if (onShutdown) {
NativeMemoryConfig nativeMemoryConfig = nodeEngine.getConfig().getNativeMemoryConfig();
boolean shouldClear = (nativeMemoryConfig != null && nativeMemoryConfig.getAllocatorType() != POOLED);
if (shouldClear) {
storage.clear(true);
}
storage.destroy(true);
} else {
storage.clear(false);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class MapReduceUtil method notifyRemoteException.
public static void notifyRemoteException(JobSupervisor supervisor, Throwable throwable) {
MapReduceService mapReduceService = supervisor.getMapReduceService();
NodeEngine nodeEngine = mapReduceService.getNodeEngine();
try {
Address jobOwner = supervisor.getJobOwner();
if (supervisor.isOwnerNode()) {
supervisor.notifyRemoteException(jobOwner, throwable);
} else {
String name = supervisor.getConfiguration().getName();
String jobId = supervisor.getConfiguration().getJobId();
NotifyRemoteExceptionOperation operation = new NotifyRemoteExceptionOperation(name, jobId, throwable);
OperationService os = nodeEngine.getOperationService();
os.send(operation, jobOwner);
}
} catch (Exception e) {
ILogger logger = nodeEngine.getLogger(MapReduceUtil.class);
logger.warning("Could not notify remote map-reduce owner", e);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class NodeStateTest method shouldReject_NormalOperationExecution_whilePassive.
@Test
public void shouldReject_NormalOperationExecution_whilePassive() throws Exception {
InvocationTask task = new InvocationTask() {
@Override
public void invoke(NodeEngine nodeEngine) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
Operation op = new DummyOperation() {
@Override
public void onExecutionFailure(Throwable e) {
latch.countDown();
}
@Override
public boolean returnsResponse() {
return false;
}
};
nodeEngine.getOperationService().run(op);
assertOpenEventually(latch);
}
};
testInvocation_whilePassive(task);
}
Aggregations