@Test void testStart() { this.di.getConfiguration().register(TestRunnableService.class); this.runnableServiceExtension.deploy(); this.runnableServiceExtension.start(); TestRunnableService service = this.di.getServiceLocator().getService(TestRunnableService.class); assertThat(service.run, is(true)); this.runnableServiceExtension.stop(); assertThat(service.run, is(false)); assertThat(service.count, is(1)); }
public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; } }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  void register(ServiceDescription<?> serviceDescription); void start(); void stop(); }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  void register(ServiceDescription<?> serviceDescription); void start(); void stop();  }