com.arjuna.ats.internal.jdbc.ConnectionSynchronization Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of narayana-jta Show documentation
Show all versions of narayana-jta Show documentation
Narayana: ArjunaJTA narayana-jta (jta uber jar)
The newest version!
/*
Copyright The Narayana Authors
SPDX-License-Identifier: Apache-2.0
*/
package com.arjuna.ats.internal.jdbc;
import com.arjuna.ats.jdbc.logging.jdbcLogger;
import jakarta.transaction.Synchronization;
/**
* A synchronization to close the database connection when the transaction
* has committed or rolled back.
*
* @version $Id: ConnectionSynchronization.java 2342 2006-03-30 13:06:17Z $
*/
public class ConnectionSynchronization implements Synchronization
{
public ConnectionSynchronization (ConnectionImple conn)
{
_theConnection = conn;
_theConnection.incrementUseCount();
}
public void afterCompletion(int status)
{
try
{
if (_theConnection != null) {
_theConnection.closeImpl();
}
}
catch (Exception ex)
{
jdbcLogger.i18NLogger.warn_not_closed(ex);
}
}
public void beforeCompletion()
{
}
private ConnectionImple _theConnection = null;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy