RFR [9] 8040837: Avoid provoking NFEs when initializing InetAddrCachePolicy

Bernd Eckenfels bernd-2014 at eckenfels.net
Thu Apr 17 19:50:23 UTC 2014


Hello,

I would propose to use Integer.valueOf(tmp) instead, but looking at the
context I think it is even better to skip this and the following null
check with Integer.parseInt().

Gruss
Bernd

what about using Integer.valueOf(tmp)
Am Thu, 17 Apr 2014 17:56:10 +0200
schrieb Claes Redestad <claes.redestad at oracle.com>:

> Hi,
> 
>   could I get a review of the following small patch to address
> 8040837:
> 
>   http://cr.openjdk.java.net/~lagergren/8040837/
>   https://bugs.openjdk.java.net/browse/JDK-8040837
> 
>   A simple JMH microbenchmark shows this actually might have a small 
> benefit to startup:
> 
>      @GenerateMicroBenchmark
>      public int loadInetAddressCachePolicy() throws 
> ClassNotFoundException, NoSuchMethodException, 
> InvocationTargetException, IllegalAccessException {
>          return 
> (Integer)Class.forName("sun.net.InetAddressCachePolicy").getMethod("get").invoke(null);
>      }
> 
>   java -jar microbenchmarks -bm ss -f 100
> 
>   before: 0.662 +- 0.086 ms
>   after:  0.616 +- 0.084 ms
> 
> /Claes



More information about the net-dev mailing list