Example usage for javax.sql XAConnection close

List of usage examples for javax.sql XAConnection close

Introduction

In this page you can find the example usage for javax.sql XAConnection close.

Prototype

void close() throws SQLException;

Source Link

Document

Closes the physical connection that this PooledConnection object represents.

Usage

From source file:org.bytesoft.bytejta.supports.serialize.XAResourceDeserializerImpl.java

protected void closeQuietly(XAConnection closeable) {
    if (closeable != null) {
        try {/*from w w  w  .j a  v a  2s. c o  m*/
            closeable.close();
        } catch (Exception ex) {
            logger.debug(ex.getMessage());
        }
    }
}

From source file:org.bytesoft.bytejta.supports.serialize.XAResourceDeserializerImpl.java

protected void closeQuietly(javax.jms.XAConnection closeable) {
    if (closeable != null) {
        try {//from  w  w w  . j  av  a 2  s . co m
            closeable.close();
        } catch (Exception ex) {
            logger.debug(ex.getMessage());
        }
    }
}

From source file:org.apache.hadoop.hive.metastore.MyXid.java

public static void closeXAConnection(XAConnection con) {
    try {/*from   www . j  av a  2s  . c o  m*/
        if (con != null) {
            con.close();
        }
    } catch (Exception x) {
        LOG.error("close connection error, msg=" + x.getMessage());
    }
}

From source file:org.eclipse.ecr.core.storage.sql.jdbc.JDBCBackend.java

/**
 * {@inheritDoc}//w  ww.  ja v  a2  s.  c o m
 * <p>
 * Opens a connection to get the dialect and finish initializing the
 * {@link ModelSetup}.
 */
@Override
public void initializeModelSetup(ModelSetup modelSetup) throws StorageException {
    try {
        XAConnection xaconnection = xadatasource.getXAConnection();
        Connection connection = null;
        try {
            connection = xaconnection.getConnection();
            dialect = Dialect.createDialect(connection, repository.getBinaryManager(),
                    repository.getRepositoryDescriptor());
        } finally {
            if (connection != null) {
                connection.close();
            }
            xaconnection.close();
        }
    } catch (SQLException e) {
        throw new StorageException(e);
    }
    modelSetup.materializeFulltextSyntheticColumn = dialect.getMaterializeFulltextSyntheticColumn();
}

From source file:org.nuxeo.ecm.core.storage.sql.jdbc.JDBCBackend.java

/**
 * {@inheritDoc}//from w  w  w  . j  av  a2 s .  c om
 * <p>
 * Opens a connection to get the dialect and finish initializing the
 * {@link ModelSetup}.
 */
@Override
public void initializeModelSetup(ModelSetup modelSetup) throws StorageException {
    try {
        XAConnection xaconnection = null;
        // try single-datasource non-XA mode
        Connection connection = ConnectionHelper.getConnection(pseudoDataSourceName);
        try {
            if (connection == null) {
                // standard XA mode
                xaconnection = xadatasource.getXAConnection();
                connection = xaconnection.getConnection();
            }
            dialect = Dialect.createDialect(connection, repository.getBinaryManager(),
                    repository.getRepositoryDescriptor());
        } finally {
            if (connection != null) {
                connection.close();
            }
            if (xaconnection != null) {
                xaconnection.close();
            }
        }
    } catch (SQLException | ResourceException cause) {
        throw new StorageException("Cannot connect to database", cause);
    }
    modelSetup.materializeFulltextSyntheticColumn = dialect.getMaterializeFulltextSyntheticColumn();
    modelSetup.supportsArrayColumns = dialect.supportsArrayColumns();
    switch (dialect.getIdType()) {
    case VARCHAR:
    case UUID:
        modelSetup.idType = IdType.STRING;
        break;
    case SEQUENCE:
        modelSetup.idType = IdType.LONG;
        break;
    default:
        throw new AssertionError(dialect.getIdType().toString());
    }
}