diff --git a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelper.java b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelper.java index 779dd5bb..1dbb967c 100644 --- a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelper.java +++ b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelper.java @@ -106,7 +106,7 @@ private XAConnection getXaConnection() throws SQLException { @Override public Xid[] recover(int flag) throws XAException { try { - return getDelegate(true).recover(flag); + return getDelegate().recover(flag); } finally { if (flag == XAResource.TMENDRSCAN) { disconnect(); @@ -127,51 +127,51 @@ private void disconnect() throws XAException { @Override public void start(Xid xid, int flags) throws XAException { - getDelegate(true).start(xid, flags); + getDelegate().start(xid, flags); } @Override public void end(Xid xid, int flags) throws XAException { - getDelegate(true).end(xid, flags); + getDelegate().end(xid, flags); } @Override public int prepare(Xid xid) throws XAException { - return getDelegate(true).prepare(xid); + return getDelegate().prepare(xid); } @Override public void commit(Xid xid, boolean onePhase) throws XAException { - getDelegate(true).commit(xid, onePhase); + getDelegate().commit(xid, onePhase); } @Override public void rollback(Xid xid) throws XAException { - getDelegate(true).rollback(xid); + getDelegate().rollback(xid); } @Override public boolean isSameRM(XAResource xaResource) throws XAException { - return getDelegate(true).isSameRM(xaResource); + return getDelegate().isSameRM(xaResource); } @Override public void forget(Xid xid) throws XAException { - getDelegate(true).forget(xid); + getDelegate().forget(xid); } @Override public int getTransactionTimeout() throws XAException { - return getDelegate(true).getTransactionTimeout(); + return getDelegate().getTransactionTimeout(); } @Override public boolean setTransactionTimeout(int seconds) throws XAException { - return getDelegate(true).setTransactionTimeout(seconds); + return getDelegate().setTransactionTimeout(seconds); } - private XAResource getDelegate(boolean required) { - if (this.delegate == null && required) { + private XAResource getDelegate() { + if (this.delegate == null) { throw new IllegalStateException("Connection has not been opened"); } return this.delegate; diff --git a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jms/pool/NamedXAResource.java b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jms/pool/NamedXAResource.java index 051fd3f2..cca7816f 100644 --- a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jms/pool/NamedXAResource.java +++ b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/jms/pool/NamedXAResource.java @@ -77,8 +77,8 @@ public int getTransactionTimeout() throws XAException { @Override public boolean isSameRM(XAResource xaRes) throws XAException { - if (xaRes instanceof NamedXAResource) { - return getResource().isSameRM(((NamedXAResource) xaRes).getResource()); + if (xaRes instanceof NamedXAResource namedXaResource) { + return getResource().isSameRM((namedXaResource).getResource()); } return false; } diff --git a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/properties/NarayanaProperties.java b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/properties/NarayanaProperties.java index be073a7f..42959330 100644 --- a/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/properties/NarayanaProperties.java +++ b/narayana-spring-boot-core/src/main/java/dev/snowdrop/boot/narayana/core/properties/NarayanaProperties.java @@ -120,7 +120,7 @@ public class NarayanaProperties { /** * 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. + * See ... for the list of supported properties. */ @NestedConfigurationProperty private final MessagingHubConnectionFactoryProperties messaginghub = new MessagingHubConnectionFactoryProperties();