private void logAndStopProcessor(final Exception ex) { if (ex instanceof CancelException) { if (logger.isDebugEnabled()) { logger .debug("Stopping the processor because cancellation occurred while processing a batch"); } } else { logger.fatal( "Stopping the processor because the following exception occurred while processing a batch:", ex); } this.processor.setIsStopped(true); }
public void setRunningStatus() throws Exception { GemFireException ex = null; try { this.initializeEventDispatcher(); } catch (GemFireException e) { ex = e; } synchronized (this.runningStateLock) { if (ex != null) { this.setException(ex); setIsStopped(true); } else { setIsStopped(false); } this.runningStateLock.notifyAll(); } if (ex != null) { throw ex; } }
this.eventProcessor.setIsStopped(true); throw e; } catch (Exception e) { "Stopping the processor because the following exception occurred while processing a batch:", e); this.eventProcessor.setIsStopped(true);
setIsStopped(true); dispatcher.stop();
@Override public void run() { try { setRunningStatus(); processQueue(); } catch (CancelException e) { if (!this.isStopped()) { logger.info("A cancellation occurred. Stopping the dispatcher."); setIsStopped(true); } } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (Throwable e) { // Whenever you catch Error or Throwable, you must also // catch VirtualMachineError (see above). However, there is // _still_ a possibility that you are dealing with a cascading // error condition, so you also need to check to see if the JVM // is still usable: SystemFailure.checkFailure(); logger.fatal("Message dispatch failed due to unexpected exception..", e); } }
setIsStopped(true); } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err);
verify(eventProcessor, Mockito.times(0)).setIsStopped(true);