diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapper.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapper.java
deleted file mode 100644
index 5d0e419c..00000000
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapper.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2020 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package me.snowdrop.boot.narayana.core.jdbc;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.sql.DataSource;
-import javax.sql.XADataSource;
-import javax.transaction.TransactionManager;
-
-import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import me.snowdrop.boot.narayana.core.properties.RecoveryCredentialsProperties;
-import org.apache.commons.dbcp2.BasicDataSource;
-import org.apache.commons.dbcp2.BasicDataSourceFactory;
-import org.apache.commons.dbcp2.managed.BasicManagedDataSource;
-
-/**
- * {@link AbstractXADataSourceWrapper} implementation that uses {@link BasicManagedDataSource} to wrap an
- * {@link XADataSource}.
- *
- * {@link BasicManagedDataSource} provides a pooling support which is not available in the Narayana transactional
- * driver.
- *
- * @author Gytis Trikleris
- */
-public class PooledXADataSourceWrapper extends AbstractXADataSourceWrapper {
-
- private final Map properties;
- private final TransactionManager transactionManager;
-
- /**
- * Create a new {@link PooledXADataSourceWrapper} instance.
- *
- * @param transactionManager underlying transaction manager
- * @param xaRecoveryModule recovery module to register data source with.
- * @param properties DBCP properties
- */
- public PooledXADataSourceWrapper(TransactionManager transactionManager, XARecoveryModule xaRecoveryModule,
- Map properties) {
- this(transactionManager, xaRecoveryModule, properties, RecoveryCredentialsProperties.DEFAULT);
- }
-
- /**
- * Create a new {@link PooledXADataSourceWrapper} instance.
- *
- * @param transactionManager underlying transaction manager
- * @param xaRecoveryModule recovery module to register data source with.
- * @param properties DBCP properties
- * @param recoveryCredentials credentials for recovery helper
- */
- public PooledXADataSourceWrapper(TransactionManager transactionManager, XARecoveryModule xaRecoveryModule,
- Map properties, RecoveryCredentialsProperties recoveryCredentials) {
- super(xaRecoveryModule, recoveryCredentials);
- this.properties = properties;
- this.transactionManager = transactionManager;
- }
-
- /**
- * Wrap the provided data source and initialize the connection pool if its initial size is higher than 0.
- *
- * @param xaDataSource data source that needs to be wrapped
- * @return wrapped data source
- * @throws Exception if data source copy or connection pool initialization has failed.
- */
- @Override
- protected DataSource wrapDataSourceInternal(XADataSource xaDataSource) throws Exception {
- BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource();
- // Managed data source does't have a factory. Therefore we need to create an unmanaged data source and then copy
- // it's configuration to the managed one.
- BasicDataSource basicDataSource = getBasicDataSource();
- copyFields(basicDataSource, basicManagedDataSource);
- basicManagedDataSource.setTransactionManager(this.transactionManager);
- basicManagedDataSource.setXaDataSourceInstance(xaDataSource);
-
- // Initialize the connections pool
- int initialSize = Integer.valueOf(this.properties.getOrDefault("initialSize", "0"));
- if (initialSize > 0) {
- basicManagedDataSource.setInitialSize(initialSize);
- basicManagedDataSource.getLogWriter(); // A trick to trigger pool initialization
- }
-
- return basicManagedDataSource;
- }
-
- private BasicDataSource getBasicDataSource() throws Exception {
- Properties dbcpProperties = new Properties();
- dbcpProperties.putAll(this.properties);
- // BasicDataSource is only used to load correct properties. Thus no connections should be created.
- dbcpProperties.put("initialSize", "0");
-
- return BasicDataSourceFactory.createDataSource(dbcpProperties);
- }
-
- private void copyFields(Object source, Object destination) throws IllegalAccessException {
- for (Field field: source.getClass().getDeclaredFields()) {
- field.setAccessible(true);
- if (field.get(source) == null || Modifier.isFinal(field.getModifiers())) {
- continue;
- }
- field.set(destination, field.get(source));
- }
- }
-
-}
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAConnection.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAConnection.java
deleted file mode 100644
index e0c8e024..00000000
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAConnection.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Copyright 2020 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package me.snowdrop.boot.narayana.core.jdbc.lrco;
-
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Executor;
-
-import javax.sql.ConnectionEvent;
-import javax.sql.ConnectionEventListener;
-import javax.sql.StatementEventListener;
-import javax.sql.XAConnection;
-import javax.transaction.xa.XAResource;
-
-public class LrcoXAConnection implements XAConnection {
-
- private final Connection physicalConnection;
- private volatile Connection handleConnection;
- private final List eventListeners;
-
- public LrcoXAConnection(Connection connection) throws SQLException {
- this.physicalConnection = connection;
- this.eventListeners = new ArrayList<>();
- }
-
- @Override
- public XAResource getXAResource() throws SQLException {
- return new LrcoXAResource(this.physicalConnection);
- }
-
- @Override
- public Connection getConnection() throws SQLException {
- Connection lastHandleConnection = this.handleConnection;
- if (lastHandleConnection != null) {
- lastHandleConnection.close();
- }
- this.handleConnection = new PooledJdbcConnection();
- return this.handleConnection;
- }
-
- @Override
- public void close() throws SQLException {
- Connection lastHandleConnection = this.handleConnection;
- if (lastHandleConnection != null) {
- lastHandleConnection.close();
- }
- this.physicalConnection.close();
- }
-
- private void closeHandle() {
- ConnectionEvent event = new ConnectionEvent(this);
- for (int i = 0; i < this.eventListeners.size(); i++) {
- ConnectionEventListener listener = this.eventListeners.get(i);
- listener.connectionClosed(event);
- }
- this.handleConnection = null;
- }
-
- @Override
- public void addConnectionEventListener(ConnectionEventListener listener) {
- if (!this.eventListeners.contains(listener)) {
- this.eventListeners.add(listener);
- }
- }
-
- @Override
- public void removeConnectionEventListener(ConnectionEventListener listener) {
- this.eventListeners.remove(listener);
- }
-
- @Override
- public void addStatementEventListener(StatementEventListener listener) {
- }
-
- @Override
- public void removeStatementEventListener(StatementEventListener listener) {
- }
-
- private final class PooledJdbcConnection implements Connection {
-
- private boolean closed;
-
- private PooledJdbcConnection() {
- this.closed = false;
- }
-
- @Override
- public void close() throws SQLException {
- if (!this.closed) {
- try {
- if (!LrcoXAConnection.this.physicalConnection.getAutoCommit()) {
- LrcoXAConnection.this.physicalConnection.rollback();
- }
- LrcoXAConnection.this.physicalConnection.setAutoCommit(true);
- } catch (SQLException e) {
- // ignore
- }
- closeHandle();
- this.closed = true;
- }
- }
-
- @Override
- public Statement createStatement() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createStatement();
- }
-
- @Override
- public PreparedStatement prepareStatement(String string) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string);
- }
-
- @Override
- public CallableStatement prepareCall(String string) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareCall(string);
- }
-
- @Override
- public String nativeSQL(String string) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.nativeSQL(string);
- }
-
- @Override
- public void setAutoCommit(boolean autoCommit) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setAutoCommit(autoCommit);
- }
-
- @Override
- public boolean getAutoCommit() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getAutoCommit();
- }
-
- @Override
- public void commit() throws SQLException {
- LrcoXAConnection.this.physicalConnection.commit();
- }
-
- @Override
- public void rollback() throws SQLException {
- LrcoXAConnection.this.physicalConnection.rollback();
- }
-
- @Override
- public boolean isClosed() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.isClosed();
- }
-
- @Override
- public DatabaseMetaData getMetaData() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getMetaData();
- }
-
- @Override
- public void setReadOnly(boolean readOnly) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setReadOnly(readOnly);
- }
-
- @Override
- public boolean isReadOnly() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.isReadOnly();
- }
-
- @Override
- public void setCatalog(String string) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setCatalog(string);
- }
-
- @Override
- public String getCatalog() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getCatalog();
- }
-
- @Override
- public void setTransactionIsolation(int level) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setTransactionIsolation(level);
- }
-
- @Override
- public int getTransactionIsolation() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getTransactionIsolation();
- }
-
- @Override
- public SQLWarning getWarnings() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getWarnings();
- }
-
- @Override
- public void clearWarnings() throws SQLException {
- LrcoXAConnection.this.physicalConnection.clearWarnings();
- }
-
- @Override
- public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createStatement(resultSetType, resultSetConcurrency);
- }
-
- @Override
- public PreparedStatement prepareStatement(String string, int i, int i1) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string, i, i1);
- }
-
- @Override
- public CallableStatement prepareCall(String string, int i, int i1) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareCall(string, i, i1);
- }
-
- @Override
- public Map> getTypeMap() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getTypeMap();
- }
-
- @Override
- public void setTypeMap(Map> map) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setTypeMap(map);
- }
-
- @Override
- public void setHoldability(int holdability) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setHoldability(holdability);
- }
-
- @Override
- public int getHoldability() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getHoldability();
- }
-
- @Override
- public Savepoint setSavepoint() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.setSavepoint();
- }
-
- @Override
- public Savepoint setSavepoint(String string) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.setSavepoint(string);
- }
-
- @Override
- public void rollback(Savepoint savepoint) throws SQLException {
- LrcoXAConnection.this.physicalConnection.rollback(savepoint);
- }
-
- @Override
- public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- LrcoXAConnection.this.physicalConnection.releaseSavepoint(savepoint);
- }
-
- @Override
- public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
- }
-
- @Override
- public PreparedStatement prepareStatement(String string, int i, int i1, int i2) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string, i, i1, i2);
- }
-
- @Override
- public CallableStatement prepareCall(String string, int i, int i1, int i2) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareCall(string, i, i1, i2);
- }
-
- @Override
- public PreparedStatement prepareStatement(String string, int i) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string, i);
- }
-
- @Override
- public PreparedStatement prepareStatement(String string, int[] ints) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string, ints);
- }
-
- @Override
- public PreparedStatement prepareStatement(String string, String[] strings) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.prepareStatement(string, strings);
- }
-
- @Override
- public Clob createClob() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createClob();
- }
-
- @Override
- public Blob createBlob() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createBlob();
- }
-
- @Override
- public NClob createNClob() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createNClob();
- }
-
- @Override
- public SQLXML createSQLXML() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createSQLXML();
- }
-
- @Override
- public boolean isValid(int timeout) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.isValid(timeout);
- }
-
- @Override
- public void setClientInfo(String string, String string1) throws SQLClientInfoException {
- LrcoXAConnection.this.physicalConnection.setClientInfo(string, string1);
- }
-
- @Override
- public void setClientInfo(Properties prprts) throws SQLClientInfoException {
- LrcoXAConnection.this.physicalConnection.setClientInfo(prprts);
- }
-
- @Override
- public String getClientInfo(String string) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getClientInfo(string);
- }
-
- @Override
- public Properties getClientInfo() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getClientInfo();
- }
-
- @Override
- public Array createArrayOf(String string, Object[] os) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createArrayOf(string, os);
- }
-
- @Override
- public Struct createStruct(String string, Object[] os) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.createStruct(string, os);
- }
-
- @Override
- public void setSchema(String string) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setSchema(string);
- }
-
- @Override
- public String getSchema() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getSchema();
- }
-
- @Override
- public void abort(Executor exctr) throws SQLException {
- LrcoXAConnection.this.physicalConnection.abort(exctr);
- }
-
- @Override
- public void setNetworkTimeout(Executor exctr, int i) throws SQLException {
- LrcoXAConnection.this.physicalConnection.setNetworkTimeout(exctr, i);
- }
-
- @Override
- public int getNetworkTimeout() throws SQLException {
- return LrcoXAConnection.this.physicalConnection.getNetworkTimeout();
- }
-
- @Override
- public T unwrap(Class type) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.unwrap(type);
- }
-
- @Override
- public boolean isWrapperFor(Class> type) throws SQLException {
- return LrcoXAConnection.this.physicalConnection.isWrapperFor(type);
- }
- }
-}
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXADataSource.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXADataSource.java
deleted file mode 100644
index 3bbf9314..00000000
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXADataSource.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2020 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package me.snowdrop.boot.narayana.core.jdbc.lrco;
-
-import java.io.PrintWriter;
-import java.sql.Driver;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import javax.sql.XAConnection;
-import javax.sql.XADataSource;
-
-public class LrcoXADataSource implements XADataSource {
-
- private final Driver driver;
- private final String url;
- private final Properties info;
-
- public LrcoXADataSource(Driver driver, String url, String username, String password) {
- this.driver = driver;
- this.url = url;
- this.info = new Properties();
- if (username != null) {
- this.info.setProperty("user", username);
- }
- if (password != null) {
- this.info.setProperty("password", password);
- }
- }
-
- @Override
- public XAConnection getXAConnection() throws SQLException {
- return new LrcoXAConnection(this.driver.connect(this.url, this.info));
- }
-
- @Override
- public XAConnection getXAConnection(String user, String password) throws SQLException {
- Properties info = new Properties(this.info);
- info.put("user", user);
- info.put("password", password);
- return new LrcoXAConnection(this.driver.connect(this.url, info));
- }
-
- @Override
- public PrintWriter getLogWriter() throws SQLException {
- throw new UnsupportedOperationException("getLogWriter");
- }
-
- @Override
- public void setLogWriter(PrintWriter out) throws SQLException {
- throw new UnsupportedOperationException("setLogWriter");
- }
-
- @Override
- public int getLoginTimeout() throws SQLException {
- return 0;
- }
-
- @Override
- public void setLoginTimeout(int seconds) throws SQLException {
- throw new UnsupportedOperationException("setLoginTimeout");
- }
-
- @Override
- public Logger getParentLogger() throws SQLFeatureNotSupportedException {
- return this.driver.getParentLogger();
- }
-}
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAResource.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAResource.java
deleted file mode 100644
index c81af853..00000000
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jdbc/lrco/LrcoXAResource.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2020 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package me.snowdrop.boot.narayana.core.jdbc.lrco;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Objects;
-
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import com.arjuna.ats.jta.resources.LastResourceCommitOptimisation;
-
-public class LrcoXAResource implements LastResourceCommitOptimisation {
-
- private final Connection connection;
- private Xid currentXid;
-
- public LrcoXAResource(Connection connection) {
- this.connection = connection;
- }
-
- private static XAException convertException(SQLException ex) {
- XAException xa = new XAException(ex.getMessage());
- xa.initCause(ex);
- return xa;
- }
-
- @Override
- public synchronized void start(Xid xid, int flags) throws XAException {
- switch (flags) {
- case XAResource.TMNOFLAGS:
- if (this.currentXid != null) {
- throw new XAException("Already enlisted in another transaction with xid " + xid);
- }
- try {
- this.connection.setAutoCommit(false);
- } catch (SQLException ex) {
- throw (XAException) new XAException("Count not turn off auto commit for a XA transaction")
- .initCause(ex);
- }
- this.currentXid = xid;
- break;
- case XAResource.TMRESUME:
- if (!xid.equals(this.currentXid)) {
- throw new XAException("Attempting to resume in different transaction: expected " + this.currentXid
- + ", but was " + xid);
- }
- break;
- default:
- throw new XAException("unknown state: " + flags);
- }
- }
-
- @Override
- public synchronized void end(Xid xid, int flags) throws XAException {
- // Should not be called
- throw new XAException(XAException.XAER_PROTO);
- }
-
- @Override
- public synchronized int prepare(Xid xid) throws XAException {
- // Should not be called
- throw new XAException(XAException.XAER_PROTO);
- }
-
- @Override
- public synchronized void commit(Xid xid, boolean onePhase) throws XAException {
- Objects.requireNonNull(xid, "xid is null");
- if (!this.currentXid.equals(xid)) {
- throw new XAException("Invalid Xid: expected " + this.currentXid + ", but was " + xid);
- }
- try {
- if (this.connection.isClosed()) {
- throw new XAException("Connection is closed");
- }
- if (!this.connection.isReadOnly()) {
- this.connection.commit();
- }
- } catch (SQLException ex) {
- throw convertException(ex);
- } finally {
- try {
- this.connection.setAutoCommit(true);
- } catch (final SQLException ex) {
- // ignore
- }
- this.currentXid = null;
- }
- }
-
- @Override
- public synchronized void rollback(Xid xid) throws XAException {
- Objects.requireNonNull(xid, "xid is null");
- if (!this.currentXid.equals(xid)) {
- throw new XAException("Invalid Xid: expected " + this.currentXid + ", but was " + xid);
- }
- try {
- this.connection.rollback();
- } catch (SQLException ex) {
- throw convertException(ex);
- } finally {
- try {
- this.connection.setAutoCommit(true);
- } catch (final SQLException ex) {
- // ignore
- }
- this.currentXid = null;
- }
- }
-
- @Override
- public Xid[] recover(int flag) throws XAException {
- return new Xid[0];
- }
-
- @Override
- public void forget(Xid xid) throws XAException {
- // Should not be called
- throw new XAException(XAException.XAER_PROTO);
- }
-
- @Override
- public boolean isSameRM(XAResource xares) throws XAException {
- return this == xares;
- }
-
- @Override
- public int getTransactionTimeout() throws XAException {
- // Should not be called
- throw new XAException(XAException.XAER_PROTO);
- }
-
- @Override
- public boolean setTransactionTimeout(int seconds) throws XAException {
- return false;
- }
-}
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/AbstractXAConnectionFactoryWrapper.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/AbstractXAConnectionFactoryWrapper.java
index 6716fb47..2199a7d6 100644
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/AbstractXAConnectionFactoryWrapper.java
+++ b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/AbstractXAConnectionFactoryWrapper.java
@@ -16,8 +16,8 @@
package me.snowdrop.boot.narayana.core.jms;
-import javax.jms.ConnectionFactory;
-import javax.jms.XAConnectionFactory;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.XAConnectionFactory;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
import com.arjuna.ats.jta.recovery.XAResourceRecoveryHelper;
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapper.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapper.java
index 8580d14f..5701d5b4 100644
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapper.java
+++ b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapper.java
@@ -16,9 +16,9 @@
package me.snowdrop.boot.narayana.core.jms;
-import javax.jms.ConnectionFactory;
-import javax.jms.XAConnectionFactory;
-import javax.transaction.TransactionManager;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.XAConnectionFactory;
+import jakarta.transaction.TransactionManager;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
import me.snowdrop.boot.narayana.core.properties.RecoveryCredentialsProperties;
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapper.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapper.java
index e19e49c8..a5be3832 100644
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapper.java
+++ b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapper.java
@@ -16,9 +16,9 @@
package me.snowdrop.boot.narayana.core.jms;
-import javax.jms.ConnectionFactory;
-import javax.jms.XAConnectionFactory;
-import javax.transaction.TransactionManager;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.XAConnectionFactory;
+import jakarta.transaction.TransactionManager;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
import me.snowdrop.boot.narayana.core.properties.MessagingHubConnectionFactoryProperties;
diff --git a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/properties/NarayanaProperties.java b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/properties/NarayanaProperties.java
index 0dd01629..0e3320b3 100644
--- a/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/properties/NarayanaProperties.java
+++ b/narayana-spring-boot-core/src/main/java/me/snowdrop/boot/narayana/core/properties/NarayanaProperties.java
@@ -19,9 +19,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
@@ -103,12 +101,6 @@ public class NarayanaProperties {
private List expiryScanners = new ArrayList<>(Collections.singletonList(
"com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"));
- /**
- * Map of DBCP specific properties used if pooled data source wrapper is enabled.
- * See https://commons.apache.org/proper/commons-dbcp/configuration.html for the list of supported properties.
- */
- private Map dbcp = new HashMap<>();
-
/**
* MessagingHub specific properties used if pooled connection factory wrapper is enabled.
* See https://github.com/messaginghub/pooled-jms/blob/master/pooled-jms-docs/Configuration.md for the list of supported properties.
@@ -201,26 +193,6 @@ public void setRecoveryDbCredentials(RecoveryCredentialsProperties recoveryDbCre
this.recoveryDbCredentials = recoveryDbCredentials;
}
- @Deprecated
- public String getRecoveryDbUser() {
- return this.recoveryDbCredentials.getUser();
- }
-
- @Deprecated
- public void setRecoveryDbUser(String recoveryDbUser) {
- this.recoveryDbCredentials.setUser(recoveryDbUser);
- }
-
- @Deprecated
- public String getRecoveryDbPass() {
- return this.recoveryDbCredentials.getPassword();
- }
-
- @Deprecated
- public void setRecoveryDbPass(String recoveryDbPass) {
- this.recoveryDbCredentials.setPassword(recoveryDbPass);
- }
-
public RecoveryCredentialsProperties getRecoveryJmsCredentials() {
return this.recoveryJmsCredentials;
}
@@ -229,34 +201,6 @@ public void setRecoveryJmsCredentials(RecoveryCredentialsProperties recoveryJmsC
this.recoveryJmsCredentials = recoveryJmsCredentials;
}
- @Deprecated
- public String getRecoveryJmsUser() {
- return this.recoveryJmsCredentials.getUser();
- }
-
- @Deprecated
- public void setRecoveryJmsUser(String recoveryJmsUser) {
- this.recoveryJmsCredentials.setUser(recoveryJmsUser);
- }
-
- @Deprecated
- public String getRecoveryJmsPass() {
- return this.recoveryJmsCredentials.getUser();
- }
-
- @Deprecated
- public void setRecoveryJmsPass(String recoveryJmsPass) {
- this.recoveryJmsCredentials.setPassword(recoveryJmsPass);
- }
-
- public Map getDbcp() {
- return this.dbcp;
- }
-
- public void setDbcp(Map dbcp) {
- this.dbcp = dbcp;
- }
-
public MessagingHubConnectionFactoryProperties getMessaginghub() {
return this.messaginghub;
}
diff --git a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/NarayanaDataSourceTests.java b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/NarayanaDataSourceTests.java
index a339297e..1f96bcdd 100644
--- a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/NarayanaDataSourceTests.java
+++ b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/NarayanaDataSourceTests.java
@@ -17,6 +17,7 @@
package me.snowdrop.boot.narayana.core.jdbc;
import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Properties;
@@ -80,8 +81,13 @@ void shouldUnwrapXaDataSource() throws SQLException {
@Test
void shouldGetConnectionAndCommit() throws SQLException {
+ DatabaseMetaData mockMetaData = mock(DatabaseMetaData.class);
Connection mockConnection = mock(Connection.class);
XAConnection mockXaConnection = mock(XAConnection.class);
+ given(mockMetaData.getDriverName()).willReturn("mock");
+ given(mockMetaData.getDriverMajorVersion()).willReturn(1);
+ given(mockMetaData.getDriverMinorVersion()).willReturn(0);
+ given(mockConnection.getMetaData()).willReturn(mockMetaData);
given(mockXaConnection.getConnection()).willReturn(mockConnection);
given(this.mockXaDataSource.getXAConnection()).willReturn(mockXaConnection);
@@ -103,8 +109,13 @@ void shouldGetConnectionAndCommit() throws SQLException {
void shouldGetConnectionAndCommitWithCredentials() throws SQLException {
String username = "testUsername";
String password = "testPassword";
+ DatabaseMetaData mockMetaData = mock(DatabaseMetaData.class);
Connection mockConnection = mock(Connection.class);
XAConnection mockXaConnection = mock(XAConnection.class);
+ given(mockMetaData.getDriverName()).willReturn("mock");
+ given(mockMetaData.getDriverMajorVersion()).willReturn(1);
+ given(mockMetaData.getDriverMinorVersion()).willReturn(0);
+ given(mockConnection.getMetaData()).willReturn(mockMetaData);
given(mockXaConnection.getConnection()).willReturn(mockConnection);
given(this.mockXaDataSource.getXAConnection(username, password)).willReturn(mockXaConnection);
diff --git a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapperTests.java b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapperTests.java
deleted file mode 100644
index 274bbd67..00000000
--- a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jdbc/PooledXADataSourceWrapperTests.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2020 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package me.snowdrop.boot.narayana.core.jdbc;
-
-import java.util.Collections;
-import java.util.Map;
-
-import javax.sql.DataSource;
-import javax.sql.XADataSource;
-import javax.transaction.TransactionManager;
-
-import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import me.snowdrop.boot.narayana.core.properties.RecoveryCredentialsProperties;
-import org.apache.commons.dbcp2.managed.BasicManagedDataSource;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Gytis Trikleris
- */
-@ExtendWith(MockitoExtension.class)
-class PooledXADataSourceWrapperTests {
-
- @Mock
- private XADataSource mockXaDataSource;
-
- @Mock
- private XARecoveryModule mockXaRecoveryModule;
-
- private Map dbcpProperties;
-
- @Mock
- private RecoveryCredentialsProperties mockRecoveryCredentialsProperties;
-
- @Mock
- private TransactionManager mockTransactionManager;
-
- private PooledXADataSourceWrapper wrapper;
-
- @BeforeEach
- void before() {
- this.dbcpProperties = Collections.singletonMap("username", "test-user");
- this.wrapper = new PooledXADataSourceWrapper(this.mockTransactionManager, this.mockXaRecoveryModule,
- this.dbcpProperties, this.mockRecoveryCredentialsProperties);
- }
-
- @Test
- void wrap() throws Exception {
- given(this.mockRecoveryCredentialsProperties.isValid()).willReturn(false);
-
- DataSource dataSource = this.wrapper.wrapDataSource(this.mockXaDataSource);
- assertThat(dataSource).isInstanceOf(BasicManagedDataSource.class);
-
- BasicManagedDataSource basicManagedDataSource = (BasicManagedDataSource) dataSource;
- assertThat(basicManagedDataSource.getTransactionManager()).isEqualTo(this.mockTransactionManager);
- assertThat(basicManagedDataSource.getXaDataSourceInstance()).isEqualTo(this.mockXaDataSource);
- assertThat(basicManagedDataSource.getUsername()).isEqualTo("test-user");
-
- verify(this.mockXaRecoveryModule).addXAResourceRecoveryHelper(any(DataSourceXAResourceRecoveryHelper.class));
- verify(this.mockRecoveryCredentialsProperties).isValid();
- }
-
- @Test
- void wrapWithCredentials() throws Exception {
- given(this.mockRecoveryCredentialsProperties.isValid()).willReturn(true);
- given(this.mockRecoveryCredentialsProperties.getUser()).willReturn("userName");
- given(this.mockRecoveryCredentialsProperties.getPassword()).willReturn("password");
-
- DataSource dataSource = this.wrapper.wrapDataSource(this.mockXaDataSource);
- assertThat(dataSource).isInstanceOf(BasicManagedDataSource.class);
-
- BasicManagedDataSource basicManagedDataSource = (BasicManagedDataSource) dataSource;
- assertThat(basicManagedDataSource.getTransactionManager()).isEqualTo(this.mockTransactionManager);
- assertThat(basicManagedDataSource.getXaDataSourceInstance()).isEqualTo(this.mockXaDataSource);
-
- verify(this.mockXaRecoveryModule).addXAResourceRecoveryHelper(any(DataSourceXAResourceRecoveryHelper.class));
- verify(this.mockRecoveryCredentialsProperties).getUser();
- verify(this.mockRecoveryCredentialsProperties).getPassword();
- }
-}
diff --git a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapperTests.java b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapperTests.java
index 2a6af51d..66c6b394 100644
--- a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapperTests.java
+++ b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/GenericXAConnectionFactoryWrapperTests.java
@@ -16,9 +16,9 @@
package me.snowdrop.boot.narayana.core.jms;
-import javax.jms.ConnectionFactory;
-import javax.jms.XAConnectionFactory;
-import javax.transaction.TransactionManager;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.XAConnectionFactory;
+import jakarta.transaction.TransactionManager;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
import me.snowdrop.boot.narayana.core.properties.RecoveryCredentialsProperties;
diff --git a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapperTest.java b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapperTest.java
index 8ac2bf71..aa48f14f 100644
--- a/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapperTest.java
+++ b/narayana-spring-boot-core/src/test/java/me/snowdrop/boot/narayana/core/jms/PooledXAConnectionFactoryWrapperTest.java
@@ -16,9 +16,9 @@
package me.snowdrop.boot.narayana.core.jms;
-import javax.jms.ConnectionFactory;
-import javax.jms.XAConnectionFactory;
-import javax.transaction.TransactionManager;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.XAConnectionFactory;
+import jakarta.transaction.TransactionManager;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
import me.snowdrop.boot.narayana.core.properties.MessagingHubConnectionFactoryProperties;
diff --git a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/pom.xml b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/pom.xml
index 15040671..6465654b 100644
--- a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/pom.xml
+++ b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/pom.xml
@@ -4,7 +4,7 @@
me.snowdrop
narayana-spring-boot-samples
- 2.6.7-SNAPSHOT
+ 3.0.0-SNAPSHOT
narayana-spring-boot-sample-2ds
diff --git a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/DataSourceConfiguration.java b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/DataSourceConfiguration.java
index b5844550..cfb7c847 100644
--- a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/DataSourceConfiguration.java
+++ b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/DataSourceConfiguration.java
@@ -19,13 +19,11 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.HashMap;
import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import me.snowdrop.boot.narayana.core.jdbc.PooledXADataSourceWrapper;
+import me.snowdrop.boot.narayana.core.jdbc.GenericXADataSourceWrapper;
import org.h2.jdbcx.JdbcDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -34,22 +32,22 @@
public class DataSourceConfiguration {
@Bean(name = "ds1")
- public DataSource firstDataSource(TransactionManager transactionManager, XARecoveryModule xaRecoveryModule) throws Exception {
+ public DataSource firstDataSource(XARecoveryModule xaRecoveryModule) throws Exception {
JdbcDataSource h2XaDataSource = new JdbcDataSource();
h2XaDataSource.setURL("jdbc:h2:mem:ds1;DB_CLOSE_DELAY=-1");
createDummyTable(h2XaDataSource);
- PooledXADataSourceWrapper wrapper = new PooledXADataSourceWrapper(transactionManager, xaRecoveryModule, new HashMap<>());
+ GenericXADataSourceWrapper wrapper = new GenericXADataSourceWrapper(xaRecoveryModule);
return wrapper.wrapDataSource(h2XaDataSource);
}
@Bean(name = "ds2")
- public DataSource secondDataSource(TransactionManager transactionManager, XARecoveryModule xaRecoveryModule) throws Exception {
+ public DataSource secondDataSource(XARecoveryModule xaRecoveryModule) throws Exception {
JdbcDataSource h2XaDataSource = new JdbcDataSource();
h2XaDataSource.setURL("jdbc:h2:mem:ds2;DB_CLOSE_DELAY=-1");
createDummyTable(h2XaDataSource);
- PooledXADataSourceWrapper wrapper = new PooledXADataSourceWrapper(transactionManager, xaRecoveryModule, new HashMap<>());
+ GenericXADataSourceWrapper wrapper = new GenericXADataSourceWrapper(xaRecoveryModule);
return wrapper.wrapDataSource(h2XaDataSource);
}
diff --git a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/ScheduledExecutor.java b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/ScheduledExecutor.java
index efda03db..897c0b32 100644
--- a/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/ScheduledExecutor.java
+++ b/narayana-spring-boot-samples/narayana-spring-boot-sample-2ds/src/main/java/me/snowdrop/narayana/sample/ScheduledExecutor.java
@@ -19,7 +19,8 @@
import java.util.Random;
import javax.sql.DataSource;
-import javax.transaction.Transactional;
+
+import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
diff --git a/narayana-spring-boot-samples/narayana-spring-boot-sample-2pc/pom.xml b/narayana-spring-boot-samples/narayana-spring-boot-sample-2pc/pom.xml
index 2d25bd0a..8c05ff0e 100644
--- a/narayana-spring-boot-samples/narayana-spring-boot-sample-2pc/pom.xml
+++ b/narayana-spring-boot-samples/narayana-spring-boot-sample-2pc/pom.xml
@@ -4,7 +4,7 @@
me.snowdrop
narayana-spring-boot-samples
- 2.6.7-SNAPSHOT
+ 3.0.0-SNAPSHOT
narayana-spring-boot-sample-2pc
@@ -32,7 +32,7 @@