Package org.activemq

Examples of org.activemq.ActiveMQSession


        this.maxSessions=maxSessions;
    }

    private ServerSessionImpl createServerSessionImpl() throws JMSException {
        int acknowledge = (activeMQAsfEndpointWorker.transacted) ? Session.SESSION_TRANSACTED : activeMQAsfEndpointWorker.endpointActivationKey.getActivationSpec().getAcknowledgeModeForSession();
        final ActiveMQSession session = (ActiveMQSession) activeMQAsfEndpointWorker.connection.createSession(activeMQAsfEndpointWorker.transacted,acknowledge);           
        final XAResource xaResource = (session instanceof XASession) ? ((XASession) session).getXAResource() : null;
        MessageEndpoint endpoint;
        try {               
            // Give the endpoint a LocalTransaction and XAResource interface to manage the tx.
            endpoint = createEndpoint(new LocalAndXATransaction(session.getTransactionContext()));
        } catch (UnavailableException e) {
            // The container could be limiting us on the number of endpoints
            // that are being created.
            session.close();
            return null;
        }
        return new ServerSessionImpl(this, (ActiveMQSession)session, activeMQAsfEndpointWorker.workManager, endpoint);
    }
View Full Code Here


    }

    private ServerSessionImpl createServerSessionImpl() throws JMSException {
        ActiveMQActivationSpec activationSpec = activeMQAsfEndpointWorker.endpointActivationKey.getActivationSpec();
        int acknowledge = (activeMQAsfEndpointWorker.transacted) ? Session.SESSION_TRANSACTED : activationSpec.getAcknowledgeModeForSession();
        final ActiveMQSession session = (ActiveMQSession) activeMQAsfEndpointWorker.connection.createSession(activeMQAsfEndpointWorker.transacted,acknowledge);           
        MessageEndpoint endpoint;
        try {               
            if( activationSpec.isUseRAManagedTransactionEnabled() ) {
                // The RA will manage the transaction commit.
                endpoint = createEndpoint(null);  
                return new ServerSessionImpl(this, (ActiveMQSession)session, activeMQAsfEndpointWorker.workManager, endpoint, true);
            } else {
                // Give the container an object to manage to transaction with.
                endpoint = createEndpoint(new LocalAndXATransaction(session.getTransactionContext()));               
                return new ServerSessionImpl(this, (ActiveMQSession)session, activeMQAsfEndpointWorker.workManager, endpoint, false);
            }
        } catch (UnavailableException e) {
            // The container could be limiting us on the number of endpoints
            // that are being created.
            session.close();
            return null;
        }
    }
View Full Code Here

     * @param transacted
     * @return
     * @throws JMSException
     */
    private JMSSessionProxy createSessionProxy(boolean transacted, int acknowledgeMode) throws JMSException {       
        ActiveMQSession session = (ActiveMQSession) getConnection().createSession(transacted, acknowledgeMode);
        RATransactionContext txContext = new RATransactionContext(managedConnection.getTransactionContext());
        session.setTransactionContext(txContext);       
        JMSSessionProxy p = new JMSSessionProxy(session);       
        p.setUseSharedTxContext(managedConnection.isInManagedTx());
        sessions.add(p);       
        return p;
    }
View Full Code Here

        this.activeMQAsfEndpointWorker = activeMQAsfEndpointWorker;
    }

    private ServerSessionImpl createServerSessionImpl() throws JMSException {
        int acknowledge = (activeMQAsfEndpointWorker.transacted) ? Session.SESSION_TRANSACTED : activeMQAsfEndpointWorker.endpointActivationKey.getActivationSpec().getAcknowledgeModeForSession();
        final ActiveMQSession session = (ActiveMQSession) activeMQAsfEndpointWorker.connection.createSession(activeMQAsfEndpointWorker.transacted,acknowledge);           
        final XAResource xaResource = (session instanceof XASession) ? ((XASession) session).getXAResource() : null;
        MessageEndpoint endpoint;
        try {               
            // Give the endpoint a LocalTransaction and XAResource interface to manage the tx.
            endpoint = createEndpoint(new LocalAndXATransaction(session.getTransactionContext()));
        } catch (UnavailableException e) {
            // The container could be limiting us on the number of endpoints
            // that are being created.
            session.close();
            return null;
        }
        return new ServerSessionImpl(this, (ActiveMQSession)session, activeMQAsfEndpointWorker.workManager, endpoint);
    }
View Full Code Here

        // lets make a snapshot before we process them
        Object[] sessionArray = sessions.toArray();
        int size = sessionArray.length;
        JMSSessionStatsImpl[] answer = new JMSSessionStatsImpl[size];
        for (int i = 0; i < size; i++) {
            ActiveMQSession session = (ActiveMQSession) sessionArray[i];
            answer[i] = session.getSessionStats();
        }
        return answer;
    }
View Full Code Here

TOP

Related Classes of org.activemq.ActiveMQSession

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.