@Test public void handlePotentiallyStuckCallsListeners() { Duration processingTime = standardHours(1); executor.handlePotentiallyStuck(processingTime); verify(listener1).handlePotentiallyStuck(null, processingTime); verify(listener2).handlePotentiallyStuck(null, processingTime); }
public void handlePotentiallyStuck(Duration processingTime) { boolean interrupt = false; for (WorkflowExecutorListener listener : executorListeners) { try { if (listener.handlePotentiallyStuck(listenerContext, processingTime)) { interrupt = true; } } catch (Throwable t) { logger.error("Error in " + listener.getClass().getName() + ".handleStuck (" + t.getMessage() + ")", t); } } if (interrupt) { thread.interrupt(); } }
WorkflowStateProcessor implements Runnable { public void handlePotentiallyStuck(Duration processingTime) { boolean interrupt = false; for (WorkflowExecutorListener listener : executorListeners) { try { if (listener.handlePotentiallyStuck(listenerContext, processingTime)) { interrupt = true; } } catch (Throwable t) { logger.error("Error in " + listener.getClass().getName() + ".handleStuck (" + t.getMessage() + ")", t); } } if (interrupt) { thread.interrupt(); } } }
WorkflowStateProcessor implements Runnable { public void handlePotentiallyStuck(Duration processingTime) { boolean interrupt = false; for (WorkflowExecutorListener listener : executorListeners) { try { if (listener.handlePotentiallyStuck(listenerContext, processingTime)) { interrupt = true; } } catch (Throwable t) { logger.error("Error in " + listener.getClass().getName() + ".handleStuck (" + t.getMessage() + ")", t); } } if (interrupt) { thread.interrupt(); } } WorkflowStateProcessor(long instanceId, Supplier<Boolean> shutdownRequested, ObjectStringMapper objectMapper, WorkflowDefinitionService workflowDefinitions,
      WorkflowInstanceService workflowInstances, WorkflowInstanceDao workflowInstanceDao, MaintenanceDao maintenanceDao,
      WorkflowInstancePreProcessor workflowInstancePreProcessor, Environment env,
      Map<Long, WorkflowStateProcessor> processingInstances, WorkflowExecutorListener... executorListeners); }
WorkflowStateProcessor implements Runnable { public void handlePotentiallyStuck(Duration processingTime) { boolean interrupt = false; for (WorkflowExecutorListener listener : executorListeners) { try { if (listener.handlePotentiallyStuck(listenerContext, processingTime)) { interrupt = true; } } catch (Throwable t) { logger.error("Error in " + listener.getClass().getName() + ".handleStuck (" + t.getMessage() + ")", t); } } if (interrupt) { thread.interrupt(); } } WorkflowStateProcessor(long instanceId, Supplier<Boolean> shutdownRequested, ObjectStringMapper objectMapper, WorkflowDefinitionService workflowDefinitions,
      WorkflowInstanceService workflowInstances, WorkflowInstanceDao workflowInstanceDao, MaintenanceDao maintenanceDao,
      WorkflowInstancePreProcessor workflowInstancePreProcessor, Environment env,
      Map<Long, WorkflowStateProcessor> processingInstances, WorkflowExecutorListener... executorListeners); @Override void run(); DateTime getStartTime(); void logPotentiallyStuck(long processingTimeSeconds); void handlePotentiallyStuck(Duration processingTime); }
WorkflowStateProcessor implements Runnable { public void handlePotentiallyStuck(Duration processingTime) { boolean interrupt = false; for (WorkflowExecutorListener listener : executorListeners) { try { if (listener.handlePotentiallyStuck(listenerContext, processingTime)) { interrupt = true; } } catch (Throwable t) { logger.error("Error in " + listener.getClass().getName() + ".handleStuck (" + t.getMessage() + ")", t); } } if (interrupt) { thread.interrupt(); } } WorkflowStateProcessor(long instanceId, Supplier<Boolean> shutdownRequested, ObjectStringMapper objectMapper, WorkflowDefinitionService workflowDefinitions,
      WorkflowInstanceService workflowInstances, WorkflowInstanceDao workflowInstanceDao, MaintenanceDao maintenanceDao,
      WorkflowInstancePreProcessor workflowInstancePreProcessor, Environment env,
      Map<Long, WorkflowStateProcessor> processingInstances, WorkflowExecutorListener... executorListeners); @Override void run(); DateTime getStartTime(); void logPotentiallyStuck(long processingTimeSeconds); void handlePotentiallyStuck(Duration processingTime);  }