diff --git a/wrapper/src/main/java/software/amazon/jdbc/plugin/readwritesplitting/ReadWriteSplittingPlugin.java b/wrapper/src/main/java/software/amazon/jdbc/plugin/readwritesplitting/ReadWriteSplittingPlugin.java index 5975936c0..587989838 100644 --- a/wrapper/src/main/java/software/amazon/jdbc/plugin/readwritesplitting/ReadWriteSplittingPlugin.java +++ b/wrapper/src/main/java/software/amazon/jdbc/plugin/readwritesplitting/ReadWriteSplittingPlugin.java @@ -280,7 +280,7 @@ private void setWriterConnection(final Connection writerConnection, () -> Messages.get( "ReadWriteSplittingPlugin.setWriterConnection", new Object[] { - writerHostSpec.getUrl()})); + writerHostSpec.getHostAndPort()})); } private void setReaderConnection(final Connection conn, final HostSpec host) { @@ -290,7 +290,7 @@ private void setReaderConnection(final Connection conn, final HostSpec host) { () -> Messages.get( "ReadWriteSplittingPlugin.setReaderConnection", new Object[] { - host.getUrl()})); + host.getHostAndPort()})); } void switchConnectionIfRequired(final boolean readOnly) throws SQLException { @@ -332,7 +332,7 @@ void switchConnectionIfRequired(final boolean readOnly) throws SQLException { "ReadWriteSplittingPlugin.fallbackToWriter", new Object[] { e.getMessage(), - this.pluginService.getCurrentHostSpec().getUrl()})); + this.pluginService.getCurrentHostSpec().getHostAndPort()})); } } } else { @@ -393,7 +393,7 @@ private void switchToWriterConnection( } LOGGER.finer(() -> Messages.get("ReadWriteSplittingPlugin.switchedFromReaderToWriter", - new Object[] {writerHost.getUrl()})); + new Object[] {writerHost.getHostAndPort()})); } private void switchCurrentConnectionTo( @@ -409,7 +409,7 @@ private void switchCurrentConnectionTo( LOGGER.finest(() -> Messages.get( "ReadWriteSplittingPlugin.settingCurrentConnection", new Object[] { - newConnectionHost.getUrl()})); + newConnectionHost.getHostAndPort()})); } private void switchToReaderConnection(final List hosts) @@ -436,15 +436,15 @@ private void switchToReaderConnection(final List hosts) try { switchCurrentConnectionTo(this.readerConnection, this.readerHostSpec); LOGGER.finer(() -> Messages.get("ReadWriteSplittingPlugin.switchedFromWriterToReader", - new Object[] {this.readerHostSpec.getUrl()})); + new Object[] {this.readerHostSpec.getHostAndPort()})); } catch (SQLException e) { if (e.getMessage() != null) { LOGGER.warning( () -> Messages.get("ReadWriteSplittingPlugin.errorSwitchingToCachedReaderWithCause", - new Object[] {this.readerHostSpec.getUrl(), e.getMessage()})); + new Object[] {this.readerHostSpec.getHostAndPort(), e.getMessage()})); } else { LOGGER.warning(() -> Messages.get("ReadWriteSplittingPlugin.errorSwitchingToCachedReader", - new Object[] {this.readerHostSpec.getUrl()})); + new Object[] {this.readerHostSpec.getHostAndPort()})); } this.readerConnection.close(); @@ -466,11 +466,11 @@ private void initializeReaderConnection(final @NonNull List hosts) thr getNewWriterConnection(writerHost); } LOGGER.warning(() -> Messages.get("ReadWriteSplittingPlugin.noReadersFound", - new Object[] {writerHost.getUrl()})); + new Object[] {writerHost.getHostAndPort()})); } else { getNewReaderConnection(); LOGGER.finer(() -> Messages.get("ReadWriteSplittingPlugin.switchedFromWriterToReader", - new Object[] {this.readerHostSpec.getUrl()})); + new Object[] {this.readerHostSpec.getHostAndPort()})); } } @@ -501,7 +501,7 @@ private void getNewReaderConnection() throws SQLException { Messages.get( "ReadWriteSplittingPlugin.failedToConnectToReader", new Object[]{ - hostSpec.getUrl()}), + hostSpec.getHostAndPort()}), e); } } @@ -516,7 +516,7 @@ private void getNewReaderConnection() throws SQLException { final HostSpec finalReaderHost = readerHost; LOGGER.finest( () -> Messages.get("ReadWriteSplittingPlugin.successfullyConnectedToReader", - new Object[] {finalReaderHost.getUrl()})); + new Object[] {finalReaderHost.getHostAndPort()})); setReaderConnection(conn, readerHost); switchCurrentConnectionTo(this.readerConnection, this.readerHostSpec); }