jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: MicroKernel.getInstance
Date Wed, 11 Apr 2012 11:48:46 GMT
Hi,

On Wed, Apr 11, 2012 at 10:00 AM, Thomas Mueller <mueller@adobe.com> 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

Mime
View raw message