Package javax.jms

Examples of javax.jms.JMSContext


        return context;
    }

    public JMSContext getContext(String id) {
        JMSContextEntry entry = contexts.get(id);
        JMSContext context = null;
        if (entry != null)
            context = entry.getCtx();
        return context;
    }
View Full Code Here


    @PreDestroy
    public synchronized void cleanup() {
        for (Entry<String, JMSContextEntry> entry : contexts.entrySet()) {
            JMSContextEntry contextEntry = entry.getValue();
            String ipId = contextEntry.getInjectionPointId();
            JMSContext context = contextEntry.getCtx();
            if (context != null) {
                try {
                    context.close();
                    logger.log(Level.FINE, localStrings.getLocalString("JMSContext.impl.close",
                                           "Closed JMSContext instance associated with id {0}: {1}.",
                                           ipId, context.toString()));
                } catch (Exception e) {
                    logger.log(Level.SEVERE, localStrings.getLocalString("JMSContext.impl.close.failure",
                                             "Failed to close JMSContext instance associated with id {0}: {1}.",
                                             ipId, context.toString()), e);
                }
            }
        }
        contexts.clear();
   }
View Full Code Here

        return manager.getContext(ipId, id, metadata, getConnectionFactory());
    }

    @Override
    public String toString() {
        JMSContext rContext = null;
        JMSContext tContext = null;
        if (isInTransaction()) {
            tContext = transactedManager.getContext(id);
            if (tContext == null)
                tContext = transactedManager.getContext(ipId, id, metadata, getConnectionFactory());
        } else {
View Full Code Here

        }
    }

    @Override
    public String toString() {
        JMSContext rContext = null;
        JMSContext tContext = null;
        try {
            if (isInTransaction()) {
                tContext = transactedManager.getContext(id);
                if (tContext == null)
                    tContext = transactedManager.getContext(ipId, id, metadata, getConnectionFactory());
View Full Code Here

        }
    }

    @Override
    public String toString() {
        JMSContext rContext = null;
        JMSContext tContext = null;
        try {
            boolean isInTransaction = isInTransaction();
            if (isInTransaction) {
                tContext = transactedManager.getContext(id);
                if (tContext == null)
View Full Code Here

    }

    protected JMSContext createContext(String ipId, JMSContextMetadata metadata, ConnectionFactory connectionFactory) {
        int sessionMode = metadata.getSessionMode();
        String userName = metadata.getUserName();
        JMSContext context = null;
        if (userName == null) {
            context = connectionFactory.createContext(sessionMode);
        } else {
            String password = metadata.getPassword();
            context = connectionFactory.createContext(userName, password, sessionMode);
        }
        logger.log(Level.FINE, localStrings.getLocalString("JMSContext.impl.create",
                               "Created new JMSContext instance associated with id {0}: {1}.",
                               ipId, context.toString()));
        return context;
    }
View Full Code Here

        return context;
    }

    public synchronized JMSContext getContext(String ipId, String id, JMSContextMetadata metadata, ConnectionFactory connectionFactory) {
        JMSContextEntry contextEntry = contexts.get(id);
        JMSContext context = null;
        if (contextEntry == null) {
            context = createContext(ipId, metadata, connectionFactory);
            ServiceLocator serviceLocator = Globals.get(ServiceLocator.class);
            InvocationManager invMgr = serviceLocator.getService(InvocationManager.class);
            contexts.put(id, new JMSContextEntry(ipId, context, invMgr.getCurrentInvocation()));
View Full Code Here

        return context;
    }

    public JMSContext getContext(String id) {
        JMSContextEntry entry = contexts.get(id);
        JMSContext context = null;
        if (entry != null)
            context = entry.getCtx();
        return context;
    }
View Full Code Here

        ComponentInvocation currentInv = invMgr.getCurrentInvocation();

        for (Entry<String, JMSContextEntry> entry : contexts.entrySet()) {
            JMSContextEntry contextEntry = entry.getValue();
            String ipId = contextEntry.getInjectionPointId();
            JMSContext context = contextEntry.getCtx();
            if (context != null) {
                ComponentInvocation inv = contextEntry.getComponentInvocation();
                if (inv != null && currentInv != inv) invMgr.preInvoke(inv);
                try {
                    context.close();
                    logger.log(Level.FINE, localStrings.getLocalString("JMSContext.impl.close",
                                           "Closed JMSContext instance associated with id {0}: {1}.",
                                           ipId, context.toString()));
                } catch (Exception e) {
                    logger.log(Level.SEVERE, localStrings.getLocalString("JMSContext.impl.close.failure",
                                             "Failed to close JMSContext instance associated with id {0}: {1}.",
                                             ipId, context.toString()), e);
                } finally {
                    if (inv != null && currentInv != inv) invMgr.postInvoke(inv);
                }
            }
        }
View Full Code Here

TOP

Related Classes of javax.jms.JMSContext

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.