@Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (Exception e) { /* Only care about non-checked exceptions * as the nature of runnable prevents checked * exceptions from happening */ ManagedContextUtils.rethrowException(e); } }
invocations.push(new ListenerInvocation((ManagedContextListener<Object>)listener, data)); throwException(firstError); return null; throwException(lastError);
@Bean DefaultManagedContext DefaultManagedContext() { DefaultManagedContext dmc = new DefaultManagedContext(); dmc.setListeners(Arrays.asList( (ManagedContextListener<?>)new DeferredContextListener(), new MdcClearListener())); ManagedContextRunnable.initializeGlobalContext(dmc); return dmc; }
final List<Identity> identitiesToReturn = new ArrayList<>(); final ApiContext context = ApiContext.getContext(); final ManagedContext managedContext = new DefaultManagedContext(); for (final Identity identity : identities) { identitiesToGet.add(new Callable<Identity>() {
invocations.push(new ListenerInvocation((ManagedContextListener<Object>) listener, data)); throwException(preError); return null; logicError = t; throwException(t); throwException(postError);
@Override public void runWithContext(final Runnable run) { try { callWithContext(new Callable<Object>() { @Override public Object call() throws Exception { run.run(); return null; } }); } catch (Exception e) { /* * Only care about non-checked exceptions as the nature of runnable * prevents checked exceptions from happening */ ManagedContextUtils.rethrowException(e); } }