Package org.mule.api.component

Examples of org.mule.api.component.LifecycleAdapter


    public void testCreateLifecycleAdapters() throws Exception
    {
        PooledJavaComponent component = createPooledComponent();
        assertEquals(0, component.lifecycleAdapterPool.getNumActive());

        LifecycleAdapter borrowed = component.borrowComponentLifecycleAdaptor();
        assertNotNull(borrowed);
        assertEquals(1, component.lifecycleAdapterPool.getNumActive());
       
        component.returnComponentLifecycleAdaptor(borrowed);
        assertEquals(0, component.lifecycleAdapterPool.getNumActive());
View Full Code Here


        return invokeComponentInstance(event);
    }

    protected Object invokeComponentInstance(MuleEvent event) throws Exception
    {
        LifecycleAdapter componentLifecycleAdapter = null;
        try
        {
            componentLifecycleAdapter = borrowComponentLifecycleAdaptor();
            return componentLifecycleAdapter.invoke(event);
        }
        finally
        {
            if (componentLifecycleAdapter != null)
            {
View Full Code Here

    protected LifecycleAdapter createLifecycleAdaptor() throws Exception
    {
        //Todo this could be moved to the LCAFactory potentially
        Object object = objectFactory.getInstance(muleContext);

        LifecycleAdapter lifecycleAdapter;
        if (lifecycleAdapterFactory != null)
        {
            // Custom lifecycleAdapterFactory set on component
            lifecycleAdapter =
                lifecycleAdapterFactory.create(object, this, flowConstruct, entryPointResolverSet, muleContext);
        }
        else if (objectFactory.isExternallyManagedLifecycle())
        {
            // If no lifecycleAdapterFactory is configured explicitly and object factory returns
            // externally managed instance then use NullLifecycleAdapter so that lifecycle
            // is not propagated
            lifecycleAdapter =
                new NullLifecycleAdapter(object, this, flowConstruct, entryPointResolverSet, muleContext);
        }
        else if (flowConstruct instanceof Service)
        {
            // Inherit lifecycleAdapterFactory from model
            lifecycleAdapter = ((Service) flowConstruct).getModel().getLifecycleAdapterFactory().create(
                object, this, flowConstruct, entryPointResolverSet, muleContext);
        }
        else
        {
            lifecycleAdapter = new DefaultComponentLifecycleAdapterFactory().create(object, this,
                flowConstruct, entryPointResolverSet, muleContext);
        }
        lifecycleAdapter.initialise();
        return lifecycleAdapter;
    }
View Full Code Here

    }

    @Override
    protected LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception
    {
        LifecycleAdapter componentLifecycleAdapter;
        if (singletonComponentLifecycleAdapter != null)
        {
            componentLifecycleAdapter = singletonComponentLifecycleAdapter;
        }
        else
        {
            componentLifecycleAdapter = createLifecycleAdaptor();
            componentLifecycleAdapter.start();
        }
        return componentLifecycleAdapter;
    }
View Full Code Here

TOP

Related Classes of org.mule.api.component.LifecycleAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.