@Test public void testRunnable() throws Exception { final List<Object> touch = new ArrayList<>(); this.context.runWithContext(new Runnable() { @Override public void run() { touch.add(new Object()); } }); assertEquals(1, touch.size()); }
@Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (final Exception e) { ManagedContextUtils.rethrowException(e); } }
DefaultManagedContext implements ManagedContext { @Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (final Exception e) { ManagedContextUtils.rethrowException(e); } } }
DefaultManagedContext implements ManagedContext { @Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (final Exception e) { ManagedContextUtils.rethrowException(e); } }  }
DefaultManagedContext implements ManagedContext { @Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (final Exception e) { ManagedContextUtils.rethrowException(e); } }  @Override void registerListener(final ManagedContextListener<?> listener); @Override void unregisterListener(final ManagedContextListener<?> listener); @Override void runWithContext(final Runnable run); @Override T callWithContext(final Callable<T> callable); List<ManagedContextListener<?>> getListeners(); void setListeners(final List<ManagedContextListener<?>> listeners); }
DefaultManagedContext implements ManagedContext { @Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (final Exception e) { ManagedContextUtils.rethrowException(e); } }  @Override void registerListener(final ManagedContextListener<?> listener); @Override void unregisterListener(final ManagedContextListener<?> listener); @Override void runWithContext(final Runnable run); @Override T callWithContext(final Callable<T> callable); List<ManagedContextListener<?>> getListeners(); void setListeners(final List<ManagedContextListener<?>> listeners);  }