Package javax.resource.spi

Examples of javax.resource.spi.ManagedConnection


  {
    boolean isValid = false;
    ManagedPoolItem poolItem = null;

    try {
      ManagedConnection mConn = mcf.createManagedConnection(subject, info);

      if (mConn == null)
        throw new ResourceException(L.l("'{0}' did not return a connection from createManagedConnection",
                                        mcf));
View Full Code Here


      if (_maxConnections < _connectionPool.size()
          || item.isConnectionError()) {
        return;
      }

      ManagedConnection mConn = item.getManagedConnection();

      if (mConn == null) {
        return;
      }

      mConn.cleanup();

      long now = Alarm.getCurrentTime();

      if (_idlePool.size() == 0)
        _idlePoolExpire = now + _idleTimeout;
View Full Code Here

    public ManagedConnection next()
    {
      if (_i == _head)
        return null;

      ManagedConnection value = _entries[_i];

      _i = (_i + 1) % _entriesLength;

      return value;
    }
View Full Code Here

            factory = new DerbySystemHomeHack(factory);
            factory = new ManagedConnectionFactoryPathHack(factory);
        }

        JdbcConnectionRequestInfo info = new JdbcConnectionRequestInfo(defaultUserName, defaultPassword, driver, url);
        ManagedConnection connection = null;
        try {
            connection = factory.createManagedConnection(null, info);
        } catch (Throwable e) {
            logger.error("Testing driver failed.  " + "[" + url + "]  "
                    + "Could not obtain a physical JDBC connection from the DriverManager."
                    + "\nThe error message was:\n" + e.getMessage() + "\nPossible cause:"
                    + "\n\to JDBC driver classes are not available to OpenEJB"
                    + "\n\to Relative paths are not resolved properly");
        } finally {
            if (connection != null) {
                try {
                    connection.destroy();
                } catch (ResourceException dontCare) {
                }
            }
        }
    }
View Full Code Here

    public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
        ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
        if (mci.getManagedConnection() != null) {
            return;
        }
        ManagedConnection mc =
                mci.getManagedConnectionFactory().createManagedConnection(
                        mci.getSubject(),
                        mci.getConnectionRequestInfo());
        mci.setManagedConnection(mc);
        GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(stack, mci);
        mci.setConnectionEventListener(listener);
        mc.addConnectionEventListener(listener);
    }
View Full Code Here

    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

        synchronized (pool) {
            try {
                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

//        }
//    }

    protected boolean internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) {
        ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
        ManagedConnection mc = mci.getManagedConnection();
        try {
            mc.cleanup();
        } catch (ResourceException e) {
            connectionReturnAction = ConnectionReturnAction.DESTROY;
        }

        boolean wasInPool = false;
View Full Code Here

    }

    public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
        if (reauthentication) {
            for (Iterator iterator = connectionSet.iterator(); iterator.hasNext();) {
                ManagedConnection managedConnection = (ManagedConnection) iterator.next();
                if (managedConnections.contains(managedConnection)) {
                    return managedConnection;
                }
            }
        } else {
            for (Iterator iterator = connectionSet.iterator(); iterator.hasNext();) {
                ManagedConnection managedConnection = (ManagedConnection) iterator.next();
//                return managedConnection;
                if (managedConnections.contains(managedConnection)) {
                    MockManagedConnection mockManagedConnection = (MockManagedConnection) managedConnection;
                    if ((subject == null ? mockManagedConnection.getSubject() == null : subject.equals(mockManagedConnection.getSubject())
                            && (cxRequestInfo == null ? mockManagedConnection.getConnectionRequestInfo() == null : cxRequestInfo.equals(mockManagedConnection.getConnectionRequestInfo())))) {
View Full Code Here

            if (connectionInfo.isUnshareable()) {
                //if one is, they all are
                return;
            }
            ManagedConnectionInfo managedConnectionInfo = connectionInfo.getManagedConnectionInfo();
            ManagedConnection managedConnection = managedConnectionInfo.getManagedConnection();
            if (managedConnection instanceof DissociatableManagedConnection
                    && managedConnectionInfo.isFirstConnectionInfo(connectionInfo)) {
                int size = connectionInfos.size();
                i.remove();
                assert size - 1 == connectionInfos.size();
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.