From 096dcc0493ed7c0aafc5de550a9f18a99a11e96e Mon Sep 17 00:00:00 2001 From: Hannah Chan Date: Thu, 28 Sep 2023 09:52:41 +1000 Subject: [PATCH] Clean Up - 'compatibleWithPreviousVersion' for 'getMetaData()' and 'getClientInfo()' (#184) Co-authored-by: Hannah Chan --- .../db/replica/api/DualConnection.java | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/atlassian/db/replica/api/DualConnection.java b/src/main/java/com/atlassian/db/replica/api/DualConnection.java index d64709be..1daf68d6 100644 --- a/src/main/java/com/atlassian/db/replica/api/DualConnection.java +++ b/src/main/java/com/atlassian/db/replica/api/DualConnection.java @@ -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 @@ -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