Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.AtomicContext


        builder.build(component);
        ContextFactory<AtomicContext> contextFactory = (ContextFactory<AtomicContext>) component.getContextFactory();
        Assert.assertNotNull(contextFactory);
        contextFactory.prepare(createContext());
        AtomicContext ctx = contextFactory.createContext();

        ctx.start();
        SystemComponentImpl instance = (SystemComponentImpl) ctx.getInstance(null);
        Assert.assertNotNull(instance.getConfigContext());
        Assert.assertNotNull(instance.getParentContext());
        Assert.assertNotNull(instance.getAutowireContext());
        Assert.assertNotNull(instance.getConfigContextSetter());
        Assert.assertNotNull(instance.getParentContextSetter());
        Assert.assertNotNull(instance.getAutowireContextSetter());
        Assert.assertEquals(1, instance.getTestInt());
        Assert.assertEquals(1d, instance.getTestDouble());
        Assert.assertEquals(1f, instance.getTestFloat());
        Assert.assertEquals((short) 1, instance.getTestShort());
        Assert.assertTrue(instance.getTestBoolean());
        Assert.assertEquals('1', instance.getTestChar());
        Assert.assertEquals((byte) 1, instance.getTestByte());
        Assert.assertEquals("test", instance.getTestString());

        Assert.assertTrue(instance.initialized());
        ctx.destroy();
        ctx.stop();
        Assert.assertTrue(instance.destroyed());
    }
View Full Code Here


            }
            // Initialize eager contexts. Note this cannot be done when we initially create each context since a component may
            // contain a forward reference to a component which has not been instantiated
            for (Context context : contexts.values()) {
                if (context instanceof AtomicContext) {
                    AtomicContext atomic = (AtomicContext) context;
                    if (atomic.isEagerInit()) {
                        // perform silent creation and manual shutdown registration
                        atomic.init();
                        destroyQueue.add(context);
                    }
                }
                context.addListener(this);
            }
View Full Code Here

        destroyQueues.put(key, shutdownQueue);
        // initialize eager components. Note this cannot be done when we initially create each context since a component may
        // contain a forward reference to a component which has not been instantiated
        for (Context context : sessionContext.values()) {
            if (context instanceof AtomicContext) {
                AtomicContext atomic = (AtomicContext) context;
                if (atomic.isEagerInit()) {
                    atomic.init()// Notify the instance
                    synchronized (shutdownQueue) {
                        shutdownQueue.add(context);
                    }
                }
            }
View Full Code Here

            }
            // initialize eager components. Note this cannot be done when we initially create each context since a component may
            // contain a forward reference to a component which has not been instantiated
            for (Context context : requestContexts.values()) {
                if (context instanceof AtomicContext) {
                    AtomicContext atomic = (AtomicContext) context;
                    if (atomic.isEagerInit()) {
                        atomic.init()// Notify the instance
                        synchronized(shutdownQueue){
                            shutdownQueue.add(context);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.AtomicContext

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.