You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Create a {@link SocketAddress} from this bolt address. This method always attempts to resolve the hostname into
107
-
* an {@link InetAddress}.
117
+
* Create a {@link SocketAddress} from this bolt address. If the resolvedAddresses set is not empty, the first element is used as the address. If the set is
118
+
* empty, the host value is used instead.
108
119
*
109
120
* @return new socket address.
110
121
* @see InetSocketAddress
111
122
*/
112
123
publicSocketAddresstoSocketAddress()
113
124
{
114
-
returnnewInetSocketAddress( host, port );
125
+
returnresolvedAddresses.stream()
126
+
.findFirst()
127
+
.map( address -> newInetSocketAddress( address, port ) )
128
+
.orElse( newInetSocketAddress( host, port ) );
115
129
}
116
130
117
131
@Override
@@ -126,9 +140,31 @@ public int port()
126
140
returnport;
127
141
}
128
142
129
-
publicSet<BoltServerAddress> resolved()
143
+
/**
144
+
* Create a stream of unicast addresses. If the resolvedAddresses set is not empty, each returned address contains precisely one resolved IP address. If the
145
+
* set is empty, a single address is returned using the host and port values, which is a unicast address within the context of this address.
0 commit comments