RFR: 8231632: HttpURLConnection::usingProxy could specify that it may lazily evaluate the fact

Chris Hegarty chris.hegarty at oracle.com
Fri Oct 18 10:51:43 UTC 2019


> On 18 Oct 2019, at 10:02, Julia Boes <julia.boes at oracle.com> wrote:
> 
> Hi,
> 
> Chris and Daniel provided some off-list feedback regarding the ProxySelector::select call. It returns a list of proxies, which could be dynamic. Each call can potentially return a different list of proxies so it's not desirable to make that call twice. An alternative is to maintain a class field that is set to true in the connect method, as done in the updated webrev.
> 
> Webrev: http://cr.openjdk.java.net/~jboes/webrevs/8231632/webrev.01/index.html

Thanks Julia, this looks good. Just a few minor comments.

1) Maybe add @Override to `public boolean usingProxy()`. ( pre-existing issue )

2) Maybe move the return on 3040 to a new line. Also use the curly braces consistently, or not at all ;-)

    3039     public boolean usingProxy() {
    3040         if (usingProxy || usingProxyInternal()) return true;
    3041 
    3042         if (instProxy != null) {
    3043             return instProxy.type().equals(Proxy.Type.HTTP);
    3044         }
    3045         return false;
    3046     }

-Chris.


More information about the net-dev mailing list