Skip to content

Commit

Permalink
Merge pull request #127 from graben/improvements
Browse files Browse the repository at this point in the history
Small improvements to code and documentation
  • Loading branch information
cmoulliard authored Jan 9, 2024
2 parents 0a59205 + 453e280 commit 42c74d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://github.com/messaginghub/pooled-jms/blob/master/pooled-jms-docs/Configuration.md">...</a> for the list of supported properties.
*/
@NestedConfigurationProperty
private final MessagingHubConnectionFactoryProperties messaginghub = new MessagingHubConnectionFactoryProperties();
Expand Down

0 comments on commit 42c74d1

Please sign in to comment.