Package javax.resource.spi

Examples of javax.resource.spi.ManagedConnection


    public void returnConnection(
            ConnectionInfo connectionInfo,
            ConnectionReturnAction connectionReturnAction) {
        ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
        ManagedConnection mc = mci.getManagedConnection();
        try {
            mc.destroy();
        } catch (ResourceException e) {
            //log and forget
        } catch (Error e) {
            throw e;
        } catch (Throwable t) {
View Full Code Here


                throw new ResourceException("ManagedConnection pool has been destroyed");
            }
            if (!pool.isEmpty()) {
                ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
                ManagedConnectionFactory managedConnectionFactory = mci.getManagedConnectionFactory();
                ManagedConnection matchedMC =
                        managedConnectionFactory
                                .matchManagedConnections(pool.keySet(),
                                        mci.getSubject(),
                                        mci.getConnectionRequestInfo());
                if (matchedMC != null) {
View Full Code Here

     */
    @Override
    protected void reconnect() throws Exception {
        super.reconnect();
        ManagedConnectionProxy proxy = (ManagedConnectionProxy) connection;
        ManagedConnection mc = proxy.getManagedConnection();
        xaResource = mc.getXAResource();
    }
View Full Code Here

        xares[1] = getXAResource(cx2);
    }

    private XAResource getXAResource(Connection connection) throws ResourceException {
        ManagedConnectionProxy proxy = (ManagedConnectionProxy) connection;
        ManagedConnection mc = proxy.getManagedConnection();
        return mc.getXAResource();
    }
View Full Code Here

  boolean isValid(Subject subject,
                  ConnectionRequestInfo requestInfo,
                  UserPoolItem userPoolItem)
  {
    try {
      ManagedConnection mConn = getManagedConnection();

      if (mConn == null) {
        return false;
      }

      Object userConn = userPoolItem.getUserConnection();

      if (userConn == null) {
        userConn = mConn.getConnection(subject, requestInfo);

        userPoolItem.setUserConnection(userConn);
      }

      return userConn != null;
View Full Code Here

   * Closes the connection.
   */
  @Override
  public void destroy()
  {
    ManagedConnection mConn = _mConn;
    _mConn = null;

    UserTransactionImpl transaction = _transaction;
    _transaction = null;

    if (mConn == null)
      return;

    _cm.removeItem(this, mConn);

    UserPoolItem userItem = _shareHead;

    if (log.isLoggable(Level.FINE))
      log.fine("connection pool destroy " + this);

    try {
      while (userItem != null) {
        UserPoolItem next = userItem.getShareNext();

        userItem.close();

        userItem = next;
      }

      /*
       * XXX: transaction.delistXaResource()
       */
    } catch (Throwable e) {
      log.log(Level.FINE, e.toString(), e);
    }

    try {
      mConn.destroy();
    } catch (Exception e) {
      log.log(Level.FINE, e.toString(), e);
    } finally {
      _cm.getConnectionTimeProbe().end(_connectionStartTime);
    }
View Full Code Here

     */
    @Override
    protected void reconnect() throws Exception {
        super.reconnect();
        ManagedConnectionProxy proxy = (ManagedConnectionProxy) connection;
        ManagedConnection mc = proxy.getManagedConnection();
        xaResource = mc.getXAResource();
    }
View Full Code Here

        xares[1] = getXAResource(cx2);
    }

    private XAResource getXAResource(Connection connection) throws ResourceException {
        ManagedConnectionProxy proxy = (ManagedConnectionProxy) connection;
        ManagedConnection mc = proxy.getManagedConnection();
        return mc.getXAResource();
    }
View Full Code Here

        ri2.setServerUrl(REMOTE_HOST);
        ri2.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
        ri2.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
        assertNotSame(ri1, ri2);

        ManagedConnection connection1 = managedConnectionFactory.createManagedConnection(null, ri1);
        ManagedConnection connection2 = managedConnectionFactory.createManagedConnection(null, ri2);
        assertTrue(connection1 != connection2);

        HashSet<ManagedConnection> set = new HashSet<ManagedConnection>();
        set.add(connection1);
        set.add(connection2);

        // Can we match for the first connection?
        ActiveMQConnectionRequestInfo ri3 = ri1.copy();
        assertTrue(ri1 != ri3 && ri1.equals(ri3));
        ManagedConnection test = managedConnectionFactory.matchManagedConnections(set, null, ri3);
        assertTrue(connection1 == test);

        // Can we match for the second connection?
        ri3 = ri2.copy();
        assertTrue(ri2 != ri3 && ri2.equals(ri3));
View Full Code Here

        ri2.setServerUrl(REMOTE_HOST);
        ri2.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
        ri2.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
        assertNotSame(ri1, ri2);
       
        ManagedConnection connection1 = managedConnectionFactory.createManagedConnection(null, ri1);
        ManagedConnection connection2 = managedConnectionFactory.createManagedConnection(null, ri2);       
        assertTrue(connection1!=connection2);
       
        HashSet set = new HashSet();
        set.add(connection1);
        set.add(connection2);
       
        // Can we match for the first connection?
        ActiveMQConnectionRequestInfo ri3 = ri1.copy();
        assertTrue( ri1!=ri3 && ri1.equals(ri3) );
        ManagedConnection test = managedConnectionFactory.matchManagedConnections(set,null, ri3);
        assertTrue( connection1==test );

        // Can we match for the second connection?
        ri3 = ri2.copy();
        assertTrue( ri2!=ri3 && ri2.equals(ri3) );
View Full Code Here

TOP

Related Classes of javax.resource.spi.ManagedConnection

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.