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

Clean Up - 'compatibleWithPreviousVersion' for 'getMetaData()' and 'getClientInfo()' #184

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
30 changes: 7 additions & 23 deletions src/main/java/com/atlassian/db/replica/api/DualConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ public boolean isClosed() {
@Override
public DatabaseMetaData getMetaData() throws SQLException {
checkClosed();
if (compatibleWithPreviousVersion) {
return connectionProvider.getWriteConnection(new RouteDecisionBuilder(Reason.RW_API_CALL)).getMetaData();
} else {
return connectionProvider.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL)).getMetaData();
}
return connectionProvider.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL)).getMetaData();
}

@Override
Expand Down Expand Up @@ -545,29 +541,17 @@ public void setClientInfo(Properties properties) throws SQLClientInfoException {
@Override
public String getClientInfo(String name) throws SQLException {
checkClosed();
if (compatibleWithPreviousVersion) {
return connectionProvider
.getWriteConnection(new RouteDecisionBuilder(Reason.RW_API_CALL))
.getClientInfo(name);
} else {
return connectionProvider
.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL))
.getClientInfo(name);
}
return connectionProvider
.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL))
.getClientInfo(name);
}

@Override
public Properties getClientInfo() throws SQLException {
checkClosed();
if (compatibleWithPreviousVersion) {
return connectionProvider
.getWriteConnection(new RouteDecisionBuilder(Reason.RW_API_CALL))
.getClientInfo();
} else {
return connectionProvider
.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL))
.getClientInfo();
}
return connectionProvider
.getReadConnection(new RouteDecisionBuilder(Reason.RO_API_CALL))
.getClientInfo();
}

@Override
Expand Down
Loading