use of com.hazelcast.client.HazelcastClientNotActiveException in project hazelcast by hazelcast.
the class ClientInvocation method notifyException.
public void notifyException(Throwable exception) {
if (!lifecycleService.isRunning()) {
clientInvocationFuture.complete(new HazelcastClientNotActiveException(exception.getMessage(), exception));
return;
}
if ((isBindToSingleConnection() && exception instanceof IOException) || System.currentTimeMillis() > retryTimeoutPointInMillis) {
clientInvocationFuture.complete(exception);
return;
}
if (isRetrySafeException(exception) || invocationService.isRedoOperation() || (exception instanceof TargetDisconnectedException && clientMessage.isRetryable())) {
try {
ClientExecutionServiceImpl executionServiceImpl = (ClientExecutionServiceImpl) this.executionService;
executionServiceImpl.schedule(this, RETRY_WAIT_TIME_IN_SECONDS, TimeUnit.SECONDS);
} catch (RejectedExecutionException e) {
if (logger.isFinestEnabled()) {
logger.finest("Retry could not be scheduled ", e);
}
clientInvocationFuture.complete(exception);
}
return;
}
clientInvocationFuture.complete(exception);
}
use of com.hazelcast.client.HazelcastClientNotActiveException in project hazelcast by hazelcast.
the class ClientInvocationServiceSupport method shutdown.
@Override
public void shutdown() {
isShutdown = true;
responseThread.interrupt();
Iterator<ClientInvocation> iterator = callIdMap.values().iterator();
while (iterator.hasNext()) {
ClientInvocation invocation = iterator.next();
iterator.remove();
invocation.notifyException(new HazelcastClientNotActiveException("Client is shutting down"));
}
assert callIdMap.isEmpty();
}
use of com.hazelcast.client.HazelcastClientNotActiveException in project hazelcast by hazelcast.
the class ClientInvocationServiceSupport method send.
protected void send(ClientInvocation invocation, ClientConnection connection) throws IOException {
if (isShutdown) {
throw new HazelcastClientNotActiveException("Client is shut down");
}
registerInvocation(invocation);
ClientMessage clientMessage = invocation.getClientMessage();
if (!isAllowedToSendRequest(connection, invocation) || !writeToConnection(connection, clientMessage)) {
final long callId = clientMessage.getCorrelationId();
ClientInvocation clientInvocation = deRegisterCallId(callId);
if (clientInvocation != null) {
throw new IOException("Packet not send to " + connection.getEndPoint());
} else {
if (invocationLogger.isFinestEnabled()) {
invocationLogger.finest("Invocation not found to deregister for call id " + callId);
}
return;
}
}
invocation.setSendConnection(connection);
}
Aggregations