/** * Stop the service. * If there is any exception noted from any executed notification, * note the exception in this class * @throws Exception exception. */ @Override protected void serviceStop() throws Exception { super.serviceStop(); // propagate any failure if (getCallbackException() != null) { throw getCallbackException(); } }
@Override protected void serviceStart() throws Exception { LOG.debug("Notifying {} after a delay of {} millis", callback, delay); ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor( new ServiceThreadFactory(getName(), true)); setExecutor(executorService); scheduledFuture = executorService.schedule(command, delay, TimeUnit.MILLISECONDS); }
@Test public void testCallableChild() throws Throwable { MockService one = new MockService("one", false, 100); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, ens, two); waitForParentToStop(parent); assertStopped(one); assertStopped(ens); assertStopped(two); assertTrue(handler.notified); String s = ens.getScheduledFuture().get(); assertEquals("hello", s); }
new ProviderCompletedCallable(execInProgress, null); Service notifier = new WorkflowCallbackService( "accumulo notifier", completedCallable,
@Test public void testCallableChild() throws Throwable { MockService one = new MockService("one", false, 100); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, ens, two); waitForParentToStop(parent); assertStopped(one); assertStopped(ens); assertStopped(two); assertTrue(handler.notified); String s = ens.getScheduledFuture().get(); assertEquals("hello", s); }
@Test public void testCallableChild() throws Throwable { MockService one = new MockService("one", false, 100); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, ens, two); waitForParentToStop(parent); assertStopped(one); assertStopped(ens); assertStopped(two); assertTrue(handler.notified); String s = ens.getScheduledFuture().get(); assertEquals("hello", s); }
@Override protected void serviceStart() throws Exception { LOG.debug("Notifying {} after a delay of {} millis", callback, delay); ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor( new ServiceThreadFactory(getName(), true)); setExecutor(executorService); scheduledFuture = executorService.schedule(command, delay, TimeUnit.MILLISECONDS); }
/** * Stop the service. * If there is any exception noted from any executed notification, * note the exception in this class * @throws Exception exception. */ @Override protected void serviceStop() throws Exception { super.serviceStop(); // propagate any failure if (getCallbackException() != null) { throw getCallbackException(); } }
@Test public void testCallableChild() throws Throwable { MockService one = new MockService("one", false, 100); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, ens, two); waitForParentToStop(parent); assertStopped(one); assertStopped(ens); assertStopped(two); assertTrue(handler.notified); String s = ens.getScheduledFuture().get(); assertEquals("hello", s); }
@Test public void testAddChild() throws Throwable { MockService one = new MockService("one", false, 5000); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, two); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); parent.addService(ens); waitForParentToStop(parent, 10000); assertStopped(one); assertStopped(two); assertStopped(ens); assertStopped(two); assertEquals("hello", ens.getScheduledFuture().get()); }
@Test public void testAddChild() throws Throwable { MockService one = new MockService("one", false, 5000); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, two); CallableHandler handler = new CallableHandler("hello"); WorkflowCallbackService<String> ens = new WorkflowCallbackService<String>("handler", handler, 100, true); parent.addService(ens); waitForParentToStop(parent, 10000); assertStopped(one); assertStopped(two); assertStopped(ens); assertStopped(two); assertEquals("hello", ens.getScheduledFuture().get()); }