Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.Context.start()


        ContextFactory<?> contextFactory = (ContextFactory<?>) component.getContextFactory();
        Assert.assertNotNull(contextFactory);
        contextFactory.prepare(createContext());
        Context ctx = contextFactory.createContext();

        ctx.start();
        TestComponent instance = (TestComponent) ctx.getInstance(null);
        assertSame(MONITOR1, instance.monitor1);
        assertSame(MONITOR2, instance.monitor2);
    }
View Full Code Here


        if (contexts == null) {
            contexts = new ConcurrentHashMap<String, Context>();
            destroyQueue = new ArrayList<Context>();
            for (ContextFactory<Context> config : contextFactories.values()) {
                Context context = config.createContext();
                context.start();
                contexts.put(context.getName(), context);
            }
            // 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()) {
View Full Code Here

        if (context == null) {
            // the configuration was added after the session had started, so create a context now and start it
            ContextFactory<Context> configuration = contextFactories.get(ctxName);
            if (configuration != null) {
                context = configuration.createContext();
                context.start();
                if (context instanceof AtomicContext) {
                    ((AtomicContext) context).init();
                }

                ctxs.put(context.getName(), context);
View Full Code Here

            return m; // already created, return
        }
        Map<String, Context> sessionContext = new ConcurrentHashMap<String, Context>(contextFactories.size());
        for (ContextFactory<Context> config : contextFactories.values()) {
            Context context = config.createContext();
            context.start();
            sessionContext.put(context.getName(), context);
        }

        List<Context> shutdownQueue = new ArrayList<Context>();
        contexts.put(key, sessionContext);
View Full Code Here

            // check to see if the configuration was added after the request was started
            ContextFactory<Context> configuration = contextFactories.get(ctxName);
            if (configuration != null) {
                ctx = configuration.createContext();
                //ctx.addListener(this);
                ctx.start();
                contexts.put(ctx.getName(), ctx);
            }
        }
        return ctx;
    }
View Full Code Here

        if (requestContexts == null) {
            requestContexts = new ConcurrentHashMap<String, Context>();
            List<Context> shutdownQueue = new ArrayList<Context>();
            for (ContextFactory<Context> config : contextFactories.values()) {
                Context context = config.createContext();
                context.start();
                requestContexts.put(context.getName(), context);
            }
            // 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()) {
View Full Code Here

        if (contexts == null) {
            contexts = new ConcurrentHashMap<String, Context> ();
            for (ContextFactory<Context> config : contextFactories.values()) {
                for (int i = 0; i < contextFactories.size(); i++) {
                    Context context = config.createContext();
                    context.start();
                    contexts.put(context.getName(), context);
                }

            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.