1111
1212import org .elasticsearch .common .io .stream .StreamInput ;
1313import org .elasticsearch .common .io .stream .StreamOutput ;
14- import org .elasticsearch .common .logging .DeprecationCategory ;
15- import org .elasticsearch .common .logging .DeprecationLogger ;
1614import org .elasticsearch .common .network .InetAddresses ;
1715import org .elasticsearch .common .transport .BoundTransportAddress ;
1816import org .elasticsearch .common .transport .TransportAddress ;
1917import org .elasticsearch .common .util .Maps ;
2018import org .elasticsearch .core .Nullable ;
21- import org .elasticsearch .core .UpdateForV9 ;
2219import org .elasticsearch .node .ReportingService ;
2320import org .elasticsearch .xcontent .XContentBuilder ;
2421
2522import java .io .IOException ;
2623import java .util .Map ;
2724
28- import static org .elasticsearch .core .Booleans .parseBoolean ;
29-
3025public class TransportInfo implements ReportingService .Info {
3126
32- private static final DeprecationLogger deprecationLogger = DeprecationLogger .getLogger (TransportInfo .class );
33-
34- /** Whether to add hostname to publish host field when serializing. */
35- @ UpdateForV9 // Remove es.transport.cname_in_publish_address property from TransportInfo in 9.0.0
36- private static final boolean CNAME_IN_PUBLISH_ADDRESS = parseBoolean (
37- System .getProperty ("es.transport.cname_in_publish_address" ),
38- false
39- );
40-
4127 private final BoundTransportAddress address ;
4228 private Map <String , BoundTransportAddress > profileAddresses ;
43- private final boolean cnameInPublishAddressProperty ;
4429
4530 public TransportInfo (BoundTransportAddress address , @ Nullable Map <String , BoundTransportAddress > profileAddresses ) {
46- this (address , profileAddresses , CNAME_IN_PUBLISH_ADDRESS );
47- }
48-
49- public TransportInfo (
50- BoundTransportAddress address ,
51- @ Nullable Map <String , BoundTransportAddress > profileAddresses ,
52- boolean cnameInPublishAddressProperty
53- ) {
5431 this .address = address ;
5532 this .profileAddresses = profileAddresses ;
56- this .cnameInPublishAddressProperty = cnameInPublishAddressProperty ;
5733 }
5834
5935 public TransportInfo (StreamInput in ) throws IOException {
@@ -67,7 +43,6 @@ public TransportInfo(StreamInput in) throws IOException {
6743 profileAddresses .put (key , value );
6844 }
6945 }
70- this .cnameInPublishAddressProperty = CNAME_IN_PUBLISH_ADDRESS ;
7146 }
7247
7348 @ Override
@@ -97,16 +72,7 @@ private String formatPublishAddressString(String propertyName, TransportAddress
9772 String publishAddressString = publishAddress .toString ();
9873 String hostString = publishAddress .address ().getHostString ();
9974 if (InetAddresses .isInetAddress (hostString ) == false ) {
100- publishAddressString = hostString + '/' + publishAddress .toString ();
101- if (cnameInPublishAddressProperty ) {
102- deprecationLogger .warn (
103- DeprecationCategory .SETTINGS ,
104- "cname_in_publish_address" ,
105- "es.transport.cname_in_publish_address system property is deprecated and no longer affects "
106- + propertyName
107- + " formatting. Remove this property to get rid of this deprecation warning."
108- );
109- }
75+ publishAddressString = hostString + '/' + publishAddress ;
11076 }
11177 return publishAddressString ;
11278 }
0 commit comments