Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements to code and documentation #127

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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