kevinrr888 commented on code in PR #5662: URL: https://github.com/apache/accumulo/pull/5662#discussion_r2180920703
########## server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java: ########## @@ -320,12 +320,13 @@ protected ServerAddress getThriftServerAddress() { return thriftServer; } - protected void updateAdvertiseAddress(HostAndPort thriftBindAddress) { - if (advertiseAddress == null) { - advertiseAddress = thriftBindAddress; - } else if (!advertiseAddress.hasPort()) { - advertiseAddress = - HostAndPort.fromParts(advertiseAddress.getHost(), thriftBindAddress.getPort()); + protected synchronized void updateAdvertiseAddress(HostAndPort thriftBindAddress) { + final HostAndPort address = advertiseAddress.get(); + if (address == null) { + advertiseAddress.compareAndSet(null, thriftBindAddress); + } else if (!address.hasPort()) { + advertiseAddress.compareAndSet(address, + HostAndPort.fromParts(address.getHost(), thriftBindAddress.getPort())); Review Comment: It seems unnecessary to sync and use AtomicReference. I think you can probably just change advertiseAddress to a regular HostAndPort and keep sync for this method and add sync to getAdvertiseAddress ########## server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java: ########## @@ -112,9 +112,9 @@ protected AbstractServer(ServerId.Type serverType, ConfigOpts opts, if (advertHP.getHost().equals(ConfigOpts.BIND_ALL_ADDRESSES)) { throw new IllegalArgumentException("Advertise address cannot be 0.0.0.0"); } - advertiseAddress = advertHP; + advertiseAddress = new AtomicReference<>(advertHP); } else { - advertiseAddress = null; + advertiseAddress = new AtomicReference<>(); } log.info("Bind address: {}, advertise address: {}", bindAddress, advertiseAddress); Review Comment: ```suggestion log.info("Bind address: {}, advertise address: {}", bindAddress, getAdvertiseAddress()); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org