Codereview requested: 6566891 RMIConnector: map value referencing map key in WeakHashMap prevents map entry to be removed

Erik Gahlin erik.gahlin at oracle.com
Tue Aug 20 09:33:10 PDT 2013


Shanliang,

Let's say the delgationSubject is null and there is previous connection 
cached (nullSubjectConn != null && nullSubjectConn.get()  != null) so 
you hit:

2016: conn = nullSubjectConn.get();

but before you get the object a GC occurs and clears reference, then 
getConnectionWithSubject would return null.

Shouldn't you assign to nullSubjectConn.get() to variable so the 
reference is kept alive? Or it OK to return null?

Also, is the

2020: if (wr != null) {

necessary?

Thanks
Erik

nullSibwhen you hit the second if-statement
  happens
shanliang skrev 2013-08-20 17:35:
> webrev: http://cr.openjdk.java.net/~sjiang/JDK-6566891/00/
>
> shanliang wrote:
>> Hi,
>>
>> Please review:
>>
>> webrev: 
>> http://amos.fr.oracle.com/jmgt/user/sjiang/webrevs/jdk8-6566891/00/
>> bug: https://jbs.oracle.com/bugs/browse/JDK-6566891
>>
>> I have passed JCK tests and unit tests.
>>
>> Thanks,
>> Shanliang
>>
>



More information about the serviceability-dev mailing list