List of usage examples for com.google.common.util.concurrent ExecutionList add
public void add(Runnable runnable, Executor executor)
From source file:org.jclouds.lifecycle.config.LifeCycleModule.java
protected void bindPostInjectionInvoke(final Closer closer, final ExecutionList list) { bindListener(any(), new TypeListener() { public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) { Collection<? extends Invokable<? super I, Object>> methods = methods(injectableType.getRawType()); for (final Invokable<? super I, Object> method : filter(methods, isPostConstruct)) { encounter.register(new InjectionListener<I>() { public void afterInjection(final I injectee) { list.add(new Runnable() { public void run() { invokeOnInjectee(method, injectee); }/*from ww w .j a v a 2 s. c o m*/ }, sameThreadExecutor()); } }); } for (final Invokable<? super I, Object> method : filter(methods, isPreDestroy)) { encounter.register(new InjectionListener<I>() { public void afterInjection(final I injectee) { closer.addToClose(new Closeable() { public void close() throws IOException { invokeOnInjectee(method, injectee); } }); } }); } } }); }