Package javax.jms

Examples of javax.jms.JMSContext


    public void checkAnnotationBasedDefinitionsWithVaultedAttributes() {
        assertNotNull(factory5);

        // verify authentication using vaulted attributes works fine
        JMSContext context = factory5.createContext();
        assertNotNull(context);
        context.close();
    }
View Full Code Here


    public void checkDeploymendDescriptorBasedDefinitionsWithVaultedAttributes() {
        assertNotNull(factory6);

        // verify authentication using vaulted attributes works fine
        JMSContext context = factory6.createContext();
        assertNotNull(context);
        context.close();
    }
View Full Code Here

            if (inTx) {
                Object resource = txSyncRegistry.getResource(TRANSACTION_KEY);
                if (resource != null) {
                    return (JMSContext) resource;
                } else {
                    final JMSContext transactedContext = create(info, inTx);
                    txSyncRegistry.putResource(TRANSACTION_KEY, resource);
                    txSyncRegistry.registerInterposedSynchronization(new Synchronization() {
                        @Override
                        public void beforeCompletion() {
                        }

                        @Override
                        public synchronized void afterCompletion(int status) {
                            transactedContext.close();
                            inTransaction = false;
                        }
                    });
                    return transactedContext;
                }
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

        }
    }

    @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

    }

    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);
            contexts.put(id, new JMSContextEntry(ipId, context));
        } else {
            context = contextEntry.getCtx();
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

    @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(id, metadata, getConnectionFactory());
    }

    @Override
    public String toString() {
        JMSContext context = manager.getContext(id);
        StringBuffer sb = new StringBuffer();
        sb.append("JMSContext Wrapper ").append(id).append(" with metadata [").append(metadata).append("]");
        if (context != null)
            sb.append(", around ").append(context);
        return sb.toString();
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.