Improve skipping of DNS resolution when creating AuthenticationDataHttp instance
improves solution added in
- It's better to use the JDK provided InetSocketAddress.createUnresolved method
to prevent unnecessary DNS resolution
*/
package org.apache.pulsar.broker.authentication;
-import io.netty.util.NetUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import javax.servlet.http.HttpServletRequest;
@@ -35,9 +34,7 @@ public class AuthenticationDataHttp implements AuthenticationDataSource {
throw new IllegalArgumentException();
}
this.request = request;
- this.remoteAddress =
- new InetSocketAddress(NetUtil.createInetAddressFromIpAddressString(request.getRemoteAddr()),
- request.getRemotePort());
+ this.remoteAddress = InetSocketAddress.createUnresolved(request.getRemoteAddr(), request.getRemotePort());
}
/*
