use of com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse in project hazelcast by hazelcast.
the class ParkedOperation method isCallTimedOut.
public boolean isCallTimedOut() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
InternalOperationService operationService = nodeEngine.getOperationService();
if (operationService.isCallTimedOut(op)) {
cancel(new CallTimeoutResponse(op.getCallId(), op.isUrgent()));
return true;
}
return false;
}
use of com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse in project hazelcast by hazelcast.
the class InboundResponseHandler method handle.
@Override
public void handle(Packet packet) throws Exception {
Response response = serializationService.toObject(packet);
Address sender = packet.getConn().getEndPoint();
try {
if (response instanceof NormalResponse) {
NormalResponse normalResponse = (NormalResponse) response;
notifyNormalResponse(normalResponse.getCallId(), normalResponse.getValue(), normalResponse.getBackupAcks(), sender);
} else if (response instanceof BackupAckResponse) {
notifyBackupComplete(response.getCallId());
} else if (response instanceof CallTimeoutResponse) {
notifyCallTimeout(response.getCallId(), sender);
} else if (response instanceof ErrorResponse) {
ErrorResponse errorResponse = (ErrorResponse) response;
notifyErrorResponse(errorResponse.getCallId(), errorResponse.getCause(), sender);
} else {
logger.severe("Unrecognized response: " + response);
}
} catch (Throwable e) {
logger.severe("While processing response...", e);
}
}
use of com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse in project hazelcast by hazelcast.
the class WaitSetEntry method isCallTimedOut.
public boolean isCallTimedOut() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
OperationServiceImpl operationService = nodeEngine.getOperationService();
if (operationService.isCallTimedOut(op)) {
cancel(new CallTimeoutResponse(op.getCallId(), op.isUrgent()));
return true;
}
return false;
}
use of com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse in project hazelcast by hazelcast.
the class OutboundResponseHandlerTest method sendResponse_whenTimeoutResponse.
@Test
public void sendResponse_whenTimeoutResponse() {
CallTimeoutResponse response = new CallTimeoutResponse(10, false);
Operation op = createDummyOperation(10);
ArgumentCaptor<Packet> argument = ArgumentCaptor.forClass(Packet.class);
when(connectionManager.transmit(argument.capture(), eq(thatAddress), anyInt())).thenReturn(true);
// make the call
handler.sendResponse(op, response);
// verify that the right object was send
assertEquals(serializationService.toData(response), argument.getValue());
}
use of com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse in project hazelcast by hazelcast.
the class Invocation method sendResponse.
@Override
public void sendResponse(Operation op, Object response) {
if (!RESPONSE_RECEIVED.compareAndSet(this, FALSE, TRUE)) {
throw new ResponseAlreadySentException("NormalResponse already responseReceived for callback: " + this + ", current-response: " + response);
}
if (response instanceof CallTimeoutResponse) {
notifyCallTimeout();
} else if (response instanceof ErrorResponse || response instanceof Throwable) {
notifyError(response);
} else if (response instanceof NormalResponse) {
NormalResponse normalResponse = (NormalResponse) response;
notifyNormalResponse(normalResponse.getValue(), normalResponse.getBackupAcks());
} else {
// there are no backups or the number of expected backups has returned; so signal the future that the result is ready
complete(response);
}
}
Aggregations