@Test public void shouldPrintErrorIfRepeatedlyThrown() throws Exception { when(configuration.framerIdleStrategy()).thenReturn(new BusySpinIdleStrategy()); when(configuration.threadFactory()).thenReturn(Thread::new); when(framer.doWork()).thenThrow(IOException.class); try (EngineScheduler scheduler = new LowResourceEngineScheduler()) { scheduler.launch( configuration, mockErrorHandler, framer, archivingAgent, monitoringAgent, conductorAgent, recordingCoordinator); assertEventuallyTrue( "Failed to invoke monitoring agent", () -> verify(monitoringAgent, atLeastOnce()).doWork() ); } }
public void launch( final EngineConfiguration configuration, final ErrorHandler errorHandler, final Agent framer, final Agent indexingAgent, final Agent monitoringAgent, final Agent conductorAgent, final RecordingCoordinator recordingCoordinator) { this.recordingCoordinator = recordingCoordinator; if (runner != null) { EngineScheduler.fail(); } final List<Agent> agents = new ArrayList<>(); Collections.addAll(agents, monitoringAgent, framer, indexingAgent, new RecordingCoordinatorAgent(), conductorAgent); agents.removeIf(Objects::isNull); runner = new AgentRunner( configuration.framerIdleStrategy(), errorHandler, null, new CompositeAgent(agents)); startOnThread(runner, configuration.threadFactory()); }
LowResourceEngineScheduler implements EngineScheduler { public void launch( final EngineConfiguration configuration, final ErrorHandler errorHandler, final Agent framer, final Agent indexingAgent, final Agent monitoringAgent, final Agent conductorAgent, final RecordingCoordinator recordingCoordinator) { this.recordingCoordinator = recordingCoordinator; if (runner != null) { EngineScheduler.fail(); } final List<Agent> agents = new ArrayList<>(); Collections.addAll(agents, monitoringAgent, framer, indexingAgent, new RecordingCoordinatorAgent(), conductorAgent); agents.removeIf(Objects::isNull); runner = new AgentRunner( configuration.framerIdleStrategy(), errorHandler, null, new CompositeAgent(agents)); startOnThread(runner, configuration.threadFactory()); } }
LowResourceEngineScheduler implements EngineScheduler { public void launch( final EngineConfiguration configuration, final ErrorHandler errorHandler, final Agent framer, final Agent indexingAgent, final Agent monitoringAgent, final Agent conductorAgent, final RecordingCoordinator recordingCoordinator) { this.recordingCoordinator = recordingCoordinator; if (runner != null) { EngineScheduler.fail(); } final List<Agent> agents = new ArrayList<>(); Collections.addAll(agents, monitoringAgent, framer, indexingAgent, new RecordingCoordinatorAgent(), conductorAgent); agents.removeIf(Objects::isNull); runner = new AgentRunner( configuration.framerIdleStrategy(), errorHandler, null, new CompositeAgent(agents)); startOnThread(runner, configuration.threadFactory()); } LowResourceEngineScheduler(); }
LowResourceEngineScheduler implements EngineScheduler { public void launch( final EngineConfiguration configuration, final ErrorHandler errorHandler, final Agent framer, final Agent indexingAgent, final Agent monitoringAgent, final Agent conductorAgent, final RecordingCoordinator recordingCoordinator) { this.recordingCoordinator = recordingCoordinator; if (runner != null) { EngineScheduler.fail(); } final List<Agent> agents = new ArrayList<>(); Collections.addAll(agents, monitoringAgent, framer, indexingAgent, new RecordingCoordinatorAgent(), conductorAgent); agents.removeIf(Objects::isNull); runner = new AgentRunner( configuration.framerIdleStrategy(), errorHandler, null, new CompositeAgent(agents)); startOnThread(runner, configuration.threadFactory()); } LowResourceEngineScheduler(); void launch(
        final EngineConfiguration configuration,
        final ErrorHandler errorHandler,
        final Agent framer,
        final Agent indexingAgent,
        final Agent monitoringAgent,
        final Agent conductorAgent,
        final RecordingCoordinator recordingCoordinator); void close(); void configure(final Aeron.Context aeronContext); }
LowResourceEngineScheduler implements EngineScheduler { public void launch( final EngineConfiguration configuration, final ErrorHandler errorHandler, final Agent framer, final Agent indexingAgent, final Agent monitoringAgent, final Agent conductorAgent, final RecordingCoordinator recordingCoordinator) { this.recordingCoordinator = recordingCoordinator; if (runner != null) { EngineScheduler.fail(); } final List<Agent> agents = new ArrayList<>(); Collections.addAll(agents, monitoringAgent, framer, indexingAgent, new RecordingCoordinatorAgent(), conductorAgent); agents.removeIf(Objects::isNull); runner = new AgentRunner( configuration.framerIdleStrategy(), errorHandler, null, new CompositeAgent(agents)); startOnThread(runner, configuration.threadFactory()); } LowResourceEngineScheduler(); void launch(
        final EngineConfiguration configuration,
        final ErrorHandler errorHandler,
        final Agent framer,
        final Agent indexingAgent,
        final Agent monitoringAgent,
        final Agent conductorAgent,
        final RecordingCoordinator recordingCoordinator); void close(); void configure(final Aeron.Context aeronContext);  }