use of com.hazelcast.spi.exception.ResponseAlreadySentException in project hazelcast by hazelcast.
the class OperationRunnerImpl method sendResponse.
private void sendResponse(Operation op, int backupAcks) {
try {
Object response = op.getResponse();
if (backupAcks > 0) {
response = new NormalResponse(response, op.getCallId(), backupAcks, op.isUrgent());
}
op.sendResponse(response);
} catch (ResponseAlreadySentException e) {
logOperationError(op, e);
}
}
use of com.hazelcast.spi.exception.ResponseAlreadySentException 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