Hi,

On Wed, Apr 11, 2012 at 10:00 AM, Thomas Mueller <[email protected]> wrote:
> What about:
>
> // replacement for MicroKernelFactory
> // uses the Java ServiceLoader or OSGi if available
> class MicroKernelManagerFactory {
>  MicroKernelManager getManager(String uri);
> }
>
> // each MK implementation needs to implement this
> interface MicroKernelManager {
>  MicroKernel getMK();
>  void dispose();
> }

So how would this work? Do I do something like this:

    MicroKernelManagerFactory factory = getFactoryFromSomewhere();
    MicroKernelManager manager = factory.getManager("something");
    try {
        MicroKernel mk = manager.getMK();
        // use the mk
    } finally {
        manager.dispose();
    }

How is this better than:

    MicroKernel mk = getMicroKernelFromSomewhere();
    // use the mk

The problem is just pushed from getting the MicroKernel instance to
getting a MicroKernelManagerFactory instance from somewhere. And you
get the added complexity of having to define the semantics of the
string argument and dealing with cases where two concurrent clients
try to start or dispose the same MicroKernel instance.

BR,

Jukka Zitting

Reply via email to