views:

2

answers:

0

We're using PicoContainer to manage lifecycle events for multiple components. We have a custom lifecycle strategy which adds support for calling Closeable.close() instead of Disposable.dispose(), just to follow standards that little bit better.

Some of the components depend on an external object, so this component is also in the container. Unfortunately, this object also implements Closeable.

Thus, there is an undesirable effect whereby when we dispose the container, it closes this external object which the container should not be managing.

Is there an elegant solution to this issue? The only solution I can think of off the top of my head is creating two containers, putting the external stuff in the parent and the internal stuff in the child, and disposing only the child.