private void lifecycleCheck(final NodeEngine engine) { if (engine == null || !engine.isRunning()) { throwNotActiveException(); } }
private void lifecycleCheck(final NodeEngine engine) { if (engine == null || !engine.isRunning()) { throwNotActiveException(); } }
private Level getLogLevel(Throwable e) { return (e instanceof MemberLeftException || e instanceof InterruptedException) || !getNodeEngine().isRunning() ? Level.INFO : Level.WARNING; }
private Level getLogLevel(Throwable e) { return (e instanceof MemberLeftException || e instanceof InterruptedException) || !getNodeEngine().isRunning() ? Level.INFO : Level.WARNING; }
private void awaitLatch(CountDownLatch countDownLatch) { try { long currentTimeoutMs = MAX_COMPLETION_LATCH_WAIT_TIME; // Call latch await in small steps to be able to check if node is still active. // If not active then throw HazelcastInstanceNotActiveException, // If closed or destroyed then throw IllegalStateException, // otherwise continue to wait until `MAX_COMPLETION_LATCH_WAIT_TIME` passes. // // Warning: Silently ignoring if latch does not countDown in time. while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP, TimeUnit.MILLISECONDS)) { currentTimeoutMs -= COMPLETION_LATCH_WAIT_TIME_STEP; if (!getNodeEngine().isRunning()) { throw new HazelcastInstanceNotActiveException(); } else if (isClosed()) { throw new IllegalStateException("Cache (" + nameWithPrefix + ") is closed!"); } else if (isDestroyed()) { throw new IllegalStateException("Cache (" + nameWithPrefix + ") is destroyed!"); } } } catch (InterruptedException e) { currentThread().interrupt(); ExceptionUtil.sneakyThrow(e); } }
private void awaitLatch(CountDownLatch countDownLatch) { try { long currentTimeoutMs = MAX_COMPLETION_LATCH_WAIT_TIME; // Call latch await in small steps to be able to check if node is still active. // If not active then throw HazelcastInstanceNotActiveException, // If closed or destroyed then throw IllegalStateException, // otherwise continue to wait until `MAX_COMPLETION_LATCH_WAIT_TIME` passes. // // Warning: Silently ignoring if latch does not countDown in time. while (currentTimeoutMs > 0 && !countDownLatch.await(COMPLETION_LATCH_WAIT_TIME_STEP, TimeUnit.MILLISECONDS)) { currentTimeoutMs -= COMPLETION_LATCH_WAIT_TIME_STEP; if (!getNodeEngine().isRunning()) { throw new HazelcastInstanceNotActiveException(); } else if (isClosed()) { throw new IllegalStateException("Cache (" + nameWithPrefix + ") is closed!"); } else if (isDestroyed()) { throw new IllegalStateException("Cache (" + nameWithPrefix + ") is destroyed!"); } } } catch (InterruptedException e) { currentThread().interrupt(); ExceptionUtil.sneakyThrow(e); } }
private void logException(Operation op, Throwable e) { ILogger logger = getLogger(); NodeEngine nodeEngine = getNodeEngine(); Level level = nodeEngine.isRunning() ? Level.WARNING : Level.FINEST; if (logger.isLoggable(level)) { logger.log(level, "While executing " + op, e); } }
private void logException(Operation op, Throwable e) { ILogger logger = getLogger(); NodeEngine nodeEngine = getNodeEngine(); Level level = nodeEngine.isRunning() ? Level.WARNING : Level.FINEST; if (logger.isLoggable(level)) { logger.log(level, "While executing " + op, e); } }
/** * Logs <tt>Exception</tt>/<tt>Error</tt> thrown during operation execution. * Operation implementations can override this behaviour according to their needs. * <p/> * This method is called on node & thread that's executing the operation. * * @param e Exception/Error thrown during operation execution */ public void logError(Throwable e) { final ILogger logger = getLogger(); if (e instanceof SilentException) { logger.finest(e.getMessage(), e); } else if (e instanceof RetryableException) { final Level level = returnsResponse() ? Level.FINEST : Level.WARNING; if (logger.isLoggable(level)) { logger.log(level, e.getClass().getName() + ": " + e.getMessage()); } } else if (e instanceof OutOfMemoryError) { try { logger.severe(e.getMessage(), e); } catch (Throwable ignored) { ignore(ignored); } } else { final Level level = nodeEngine != null && nodeEngine.isRunning() ? Level.SEVERE : Level.FINEST; if (logger.isLoggable(level)) { logger.log(level, e.getMessage(), e); } } }
/** * Logs <tt>Exception</tt>/<tt>Error</tt> thrown during operation execution. * Operation implementations can override this behaviour according to their needs. * <p/> * This method is called on node & thread that's executing the operation. * * @param e Exception/Error thrown during operation execution */ public void logError(Throwable e) { final ILogger logger = getLogger(); if (e instanceof SilentException) { logger.finest(e.getMessage(), e); } else if (e instanceof RetryableException) { final Level level = returnsResponse() ? Level.FINEST : Level.WARNING; if (logger.isLoggable(level)) { logger.log(level, e.getClass().getName() + ": " + e.getMessage()); } } else if (e instanceof OutOfMemoryError) { try { logger.severe(e.getMessage(), e); } catch (Throwable ignored) { ignore(ignored); } } else { final Level level = nodeEngine != null && nodeEngine.isRunning() ? Level.SEVERE : Level.FINEST; if (logger.isLoggable(level)) { logger.log(level, e.getMessage(), e); } } }
void notifyNormalResponse(long callId, Object value, int backupCount, Address sender) { responsesNormal.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning()) { logger.warning("No Invocation found for normal response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyNormalResponse(value, backupCount); }
void notifyErrorResponse(long callId, Object cause, Address sender) { responsesError.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning() && callId != 0) { logger.warning("No Invocation found for error response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyError(cause); }
void notifyNormalResponse(long callId, Object value, int backupCount, Address sender) { responsesNormal.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning()) { logger.warning("No Invocation found for normal response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyNormalResponse(value, backupCount); }
void notifyCallTimeout(long callId, Address sender) { responsesTimeout.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning()) { logger.warning("No Invocation found for call timeout response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyCallTimeout(); } }
void notifyErrorResponse(long callId, Object cause, Address sender) { responsesError.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning() && callId != 0) { logger.warning("No Invocation found for error response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyError(cause); }
void notifyCallTimeout(long callId, Address sender) { responsesTimeout.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning()) { logger.warning("No Invocation found for call timeout response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyCallTimeout(); } }
@Override public void run() { InternalPartitionServiceImpl partitionService = getService(); final ILogger logger = getLogger(); final Address caller = getCallerAddress(); final NodeEngine nodeEngine = getNodeEngine(); final ClusterService clusterService = nodeEngine.getClusterService(); final Address masterAddress = clusterService.getMasterAddress(); if (nodeEngine.isRunning()) { logger.severe("Received a shutdown response from " + caller + ", but this node is not shutting down!"); return; } boolean fromMaster = masterAddress.equals(caller); if (fromMaster) { if (logger.isFinestEnabled()) { logger.finest("Received shutdown response from " + caller); } partitionService.onShutdownResponse(); } else { logger.warning("Received shutdown response from " + caller + " but known master is: " + masterAddress); } }
@Override public void run() { InternalPartitionServiceImpl partitionService = getService(); final ILogger logger = getLogger(); final Address caller = getCallerAddress(); final NodeEngine nodeEngine = getNodeEngine(); final ClusterService clusterService = nodeEngine.getClusterService(); final Address masterAddress = clusterService.getMasterAddress(); if (nodeEngine.isRunning()) { logger.severe("Received a shutdown response from " + caller + ", but this node is not shutting down!"); return; } boolean fromMaster = masterAddress.equals(caller); if (fromMaster) { if (logger.isFinestEnabled()) { logger.finest("Received shutdown response from " + caller); } partitionService.onShutdownResponse(); } else { logger.warning("Received shutdown response from " + caller + " but known master is: " + masterAddress); } }