Re: RFR:8046500 GetIpAddrTable function failed on Pure Ipv6 environment

2018-11-13 Thread vyom tewari

reseeding again,  looks like some problem with my email client.

Vyom

On 13/11/18 6:05 PM, vyom tewari wrote:

Hi Chris,

Thanks for review, please find the latest 
webrev(http://cr.openjdk.java.net/~vtewari/8046500/webrev0.1/index.html) 
where i incorporated your suggestion. Now i am returning the different 
error code(-2) if IP Helper Library function GetIfTable fails. I 
checked the all other call sites and we don't need to do any 
additional changes.


Thanks,

Vyom

On 08/11/18 6:19 PM, Chris Hegarty wrote:

Hi Vyom,

On 08/11/18 09:22, vyom tewari wrote:

Hi,

Please review the below code change.

Webrev: 
http://cr.openjdk.java.net/~vtewari/8046500/webrev0.0/index.html


enumInterfaces may return -1 for error conditions other than
IP Helper Library GetIfTable function failed. I wonder if this
specific failure should have its own separate return value,
maybe -2, so as to not be confused with other error conditions?

Similarly enumAddresses_win.

Of course all call sites of these functions will need to be
checked if this is done, but there are not that many.

-Chris


Re: RFR [12] 8213490: Networking area nano cleanup

2018-11-13 Thread Ivan Gerasimov

Also, in

src/java.base/windows/classes/sun/net/dns/ResolverConfigurationImpl.java

-// Addreses have changed
+// Addresses have changed

Wasn't it meant to be singular?  I.e. "Address has changed"

And the same thing on the line 84.


src/java.base/windows/native/libnet/net_util_md.c

+ * 2. If the requested port is 0 (ie. any port) then we try to bind in 
v4 space


I still see `ie.`.
Not like it really matters in this context :)


With kind regards,
Ivan


On 11/13/18 2:29 PM, Ivan Gerasimov wrote:


Thanks Pavel, looks good!

*src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java*

I wonder if 'I' needs to be capitalized, as it starts a sentence:

  * Authenticator for a particular realm is single threaded.
- * ie. if multiple threads need to get credentials from the user
+ * i.e. if multiple threads need to get credentials from the user
  * at the same time, then all but the first will block until

No need for a separate review, if you agree to change i -> I.

With kind regards,

Ivan


On 11/12/18 6:45 PM, Pavel Rappo wrote:

On 13 Nov 2018, at 00:35, Ivan Gerasimov  wrote:

Do you want to change  ie. -> i.e.  here as well:

src/java.base/windows/native/libnet/net_util_md.c

- * 2. If the reqeusted port is 0 (ie. any port) then we try to bind in v4 space
+ * 2. If the requested port is 0 (ie. any port) then we try to bind in v4 space

Thanks. I have addressed "eg." too, please see the result here:

   http://cr.openjdk.java.net/~prappo/8213490/webrev.02/


And a couple more of duplicate words to remove:

jdk/internal/net/http/Http1AsyncReceiver.java:// If the queue is not 
empty, wait until it it is empty before
jdk/internal/net/http/Http2Connection.java:// if true, the the stream may 
be assigned to this connection

After I have noticed this this pattern [*] I wrote a tiny tool to help me search
for occurrences of it in comments and javadocs. It's just a little bit more
complicated than a bunch of regexes, as javadoc structures (e.g. "{@link method
method}" or "@param number number", etc.) would otherwise yield too many false
positives. Your comment reminded me that I forgot about single-line comments.
The tool has been updated. Thanks.

[*] Pun intended




--
With kind regards,
Ivan Gerasimov


--
With kind regards,
Ivan Gerasimov



Re: RFR [12] 8213490: Networking area nano cleanup

2018-11-13 Thread Ivan Gerasimov

Thanks Pavel, looks good!

*src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java*

I wonder if 'I' needs to be capitalized, as it starts a sentence:

  * Authenticator for a particular realm is single threaded.
- * ie. if multiple threads need to get credentials from the user
+ * i.e. if multiple threads need to get credentials from the user
  * at the same time, then all but the first will block until

No need for a separate review, if you agree to change i -> I.

With kind regards,

Ivan


On 11/12/18 6:45 PM, Pavel Rappo wrote:

On 13 Nov 2018, at 00:35, Ivan Gerasimov  wrote:

Do you want to change  ie. -> i.e.  here as well:

src/java.base/windows/native/libnet/net_util_md.c

- * 2. If the reqeusted port is 0 (ie. any port) then we try to bind in v4 space
+ * 2. If the requested port is 0 (ie. any port) then we try to bind in v4 space

Thanks. I have addressed "eg." too, please see the result here:

   http://cr.openjdk.java.net/~prappo/8213490/webrev.02/


And a couple more of duplicate words to remove:

jdk/internal/net/http/Http1AsyncReceiver.java:// If the queue is not 
empty, wait until it it is empty before
jdk/internal/net/http/Http2Connection.java:// if true, the the stream may 
be assigned to this connection

After I have noticed this this pattern [*] I wrote a tiny tool to help me search
for occurrences of it in comments and javadocs. It's just a little bit more
complicated than a bunch of regexes, as javadoc structures (e.g. "{@link method
method}" or "@param number number", etc.) would otherwise yield too many false
positives. Your comment reminded me that I forgot about single-line comments.
The tool has been updated. Thanks.

[*] Pun intended




--
With kind regards,
Ivan Gerasimov



Re: A parallel HttpClient sendAync question

2018-11-13 Thread Weijun Wang
> 
> That's what I would use too. Though Chris Y.'s suggestion below
> should also work:
> 
> On 13/11/2018 03:41, Chris Yin wrote: > lines.flapMap(x -> 
> Stream.ofNullable(findURIFrom(x)))
>>.map(l -> download(c, l))
>>.collect(Collectors.toList())
>>.forEach(f -> f.join());
> 
> since the collection should exhaust the stream before starting
> the forEach loop.

Yes, this should work.

While I know the last forEach here is not Stream::forEach, I cannot stop 
thinking there are 2 terminal operations in this call chain. Almost feel like 
cheating. :-)

--Max

> 
> best regards,
> 
> -- daniel
> 



Re: RFR:8046500 GetIpAddrTable function failed on Pure Ipv6 environment

2018-11-13 Thread vyom tewari

Hi Chris,

Thanks for review, please find the latest 
webrev(http://cr.openjdk.java.net/~vtewari/8046500/webrev0.1/index.html) 
where i incorporated your suggestion. Now i am returning the different 
error code(-2) if IP Helper Library function GetIfTable fails. I checked 
the all other call sites and we don't need to do any additional changes.


Thanks,

Vyom

On 08/11/18 6:19 PM, Chris Hegarty wrote:

Hi Vyom,

On 08/11/18 09:22, vyom tewari wrote:

Hi,

Please review the below code change.

Webrev: http://cr.openjdk.java.net/~vtewari/8046500/webrev0.0/index.html


enumInterfaces may return -1 for error conditions other than
IP Helper Library GetIfTable function failed. I wonder if this
specific failure should have its own separate return value,
maybe -2, so as to not be confused with other error conditions?

Similarly enumAddresses_win.

Of course all call sites of these functions will need to be
checked if this is done, but there are not that many.

-Chris


Re: RFR [12] 8213490: Networking area nano cleanup

2018-11-13 Thread Alan Bateman

On 12/11/2018 23:51, Pavel Rappo wrote:

Daniel, Alan,

I excluded the update from the draft to the RFC and created a separate bug
for it:

   [P5] 8213757: Investigate the possibility of updating the reference to the
   spec in java.net.Inet6Address

I added the changes to the URI class from JDK-8213490, which then effectively
became a duplicate. Please have a look at the result here:

   http://cr.openjdk.java.net/~prappo/8213490/webrev.01/

Looks good and a separate issue to investigate if there is any issues 
with a dependency on RFC 4007 is good.


-Alan


Re: RFR [12] 8213490: Networking area nano cleanup

2018-11-13 Thread Daniel Fuchs

On 13/11/2018 11:13, Chris Hegarty wrote:



On 13 Nov 2018, at 02:45, Pavel Rappo  wrote:
...
  http://cr.openjdk.java.net/~prappo/8213490/webrev.02/


Looks fine.


I concur.

best regards,

-- daniel



-Chris.





Re: RFR [12] 8213490: Networking area nano cleanup

2018-11-13 Thread Chris Hegarty


> On 13 Nov 2018, at 02:45, Pavel Rappo  wrote:
> ...
>  http://cr.openjdk.java.net/~prappo/8213490/webrev.02/

Looks fine.

-Chris.


Re: A parallel HttpClient sendAync question

2018-11-13 Thread Daniel Fuchs

Hi Max,

On 13/11/2018 02:35, Weijun Wang wrote:

I'm scanning a file and downloading links inside:

lines.flapMap(x -> Stream.ofNullable(findURIFrom(x)))
  .map(l -> download(c, l))
  .forEach(f -> f.join());

CompletableFuture> download(HttpClient c, URI link) {
 return c.sendAsync(HttpRequest.newBuilder(link).build(),
 HttpResponse.BodyHandlers.ofFile(Path.of(link.getPath(;
}

However, it seems the download is one by one and not parallel. I guess maybe 
map() is lazy and each request is only send when forEach() is called and the 
next one is only sent after join().


I believe this is true.


I can only collect the jobs into a list and then call join() on 
CompletableFuture.allOf(list). Is there a simpler way?


That's what I would use too. Though Chris Y.'s suggestion below
should also work:

On 13/11/2018 03:41, Chris Yin wrote: > lines.flapMap(x -> 
Stream.ofNullable(findURIFrom(x)))

.map(l -> download(c, l))
.collect(Collectors.toList())
.forEach(f -> f.join());


since the collection should exhaust the stream before starting
the forEach loop.

best regards,

-- daniel