use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class OperationParkerImpl method shutdown.
public void shutdown() {
logger.finest("Stopping tasks...");
expirationTaskFuture.cancel(true);
expirationExecutor.shutdown();
final Object response = new HazelcastInstanceNotActiveException();
final Address thisAddress = nodeEngine.getThisAddress();
for (Queue<ParkedOperation> parkQueue : parkQueueMap.values()) {
for (ParkedOperation parkedOperation : parkQueue) {
if (!parkedOperation.isValid()) {
continue;
}
Operation op = parkedOperation.getOperation();
// only for local invocations, remote ones will be expired via #onMemberLeft()
if (thisAddress.equals(op.getCallerAddress())) {
try {
OperationResponseHandler responseHandler = op.getOperationResponseHandler();
responseHandler.sendResponse(op, response);
} catch (Exception e) {
logger.finest("While sending HazelcastInstanceNotActiveException response...", e);
}
}
}
parkQueue.clear();
}
parkQueueMap.clear();
}
use of com.hazelcast.spi.Operation 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);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class AbstractCacheProxy method getAsync.
@Override
public InternalCompletableFuture<V> getAsync(K key, ExpiryPolicy expiryPolicy) {
ensureOpen();
validateNotNull(key);
Data keyData = serializationService.toData(key);
Operation op = operationProvider.createGetOperation(keyData, expiryPolicy);
return invoke(op, keyData, false);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class ReplicatedMapProxy method createPutAllOperationFuture.
private Future createPutAllOperationFuture(String name, ReplicatedMapEntries entrySet, int partitionId) {
OperationService operationService = nodeEngine.getOperationService();
Operation op = new PutAllOperation(name, entrySet);
return operationService.invokeOnPartition(SERVICE_NAME, op, partitionId);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class QueueService method rollbackTransaction.
@Override
public void rollbackTransaction(String transactionId) {
final Set<String> queueNames = containerMap.keySet();
IPartitionService partitionService = nodeEngine.getPartitionService();
OperationService operationService = nodeEngine.getOperationService();
for (String name : queueNames) {
int partitionId = partitionService.getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
Operation operation = new QueueTransactionRollbackOperation(name, transactionId).setPartitionId(partitionId).setService(this).setNodeEngine(nodeEngine);
operationService.execute(operation);
}
}
Aggregations