Playing with the Closer [1], as Andrew suggested, may be the way to go. However, if you look at the implementation, it closes all references in reverse order, so you should add your closer to the top of the list, and I don't think you can do that.
Perhaps you need to subclass the jclouds default Closer and override the close() method to call the super and set the flag once it has finished closing all the stuff. You should be able to wire your custom implementation by providing a custom Guice module when creating the context. Something like: ContextBuilder..... .modules(ImmutableSet.of(new AbstractModule() { @Override public void configure() { bind(Closer.class).to(YourCustomCloser.class); } })) HTH Ignasi [1] https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/lifecycle/Closer.java On 14 June 2013 00:20, Andrew Phillips <andr...@apache.org> wrote: >> How to add my Closer via ctx.utils().injector()(I don't know guice :) )? > > > Ah...hm...for jclouds stuff, it's certainly a good hint to have a look at > Guice ;-) > > Try > > Closer closer = ctx.utils().injector().getInstance(Closer.class); > > That will get you *a* closer but without looking at the code I'm not 100% > sure of whether you'll get the *same* closer. Still, worth a first shot ;-) > > ap