You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2021/07/19 05:24:40 UTC

[GitHub] [incubator-eventmesh] liutaohua opened a new issue #446: Methods that continuously call WeakReference wrapper may throw an NPE

liutaohua opened a new issue #446:
URL: https://github.com/apache/incubator-eventmesh/issues/446


   All methods using `WeakReference` must check whether it is `NULL` after calling `get()`.
   
   ![image](https://user-images.githubusercontent.com/7805272/126107175-25e3b61d-3710-453f-b065-224ec6690e84.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] lrhkobe commented on issue #446: Methods that continuously call WeakReference wrapper may throw an NPE

Posted by GitBox <gi...@apache.org>.
lrhkobe commented on issue #446:
URL: https://github.com/apache/incubator-eventmesh/issues/446#issuecomment-882404842


   The weak reference of `ClientGroupWrapper`  in `Session.java`  is designed to avoid circular reference.
   Because ClientGroupWrapper contains the reference of Session, and  Session contains the reference of ClientGroupWrapper.
   
   You are right. When system GC occurs, weak references will be recycled, but if the strong reference of ClientGroupWrapper also exists, maybe it will not be a problem. 
   
   We can find strong reference  in the `clientGroupMap` field of  `ClientSessionGroupMapping.java` :
   ```
   private ConcurrentHashMap<String, ClientGroupWrapper> clientGroupMap;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] lrhkobe commented on issue #446: Methods that continuously call WeakReference wrapper may throw an NPE

Posted by GitBox <gi...@apache.org>.
lrhkobe commented on issue #446:
URL: https://github.com/apache/incubator-eventmesh/issues/446#issuecomment-882404842


   The weak reference of `ClientGroupWrapper`  in `Session.java`  is designed to avoid circular reference.
   Because ClientGroupWrapper contains the reference of Session, and  Session contains the reference of ClientGroupWrapper.
   
   You are right. When system GC occurs, weak references will be recycled, but if the strong reference of ClientGroupWrapper also exists, maybe it will not be a problem. 
   
   We can find strong reference  in the `clientGroupMap` field of  `ClientSessionGroupMapping.java` :
   ```
   private ConcurrentHashMap<String, ClientGroupWrapper> clientGroupMap;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] liutaohua commented on issue #446: Methods that continuously call WeakReference wrapper may throw an NPE

Posted by GitBox <gi...@apache.org>.
liutaohua commented on issue #446:
URL: https://github.com/apache/incubator-eventmesh/issues/446#issuecomment-882269596


   > Yes, this does happen when the system gc occur, maybe we can use strong reference instead of weak reference.
   
   I need to continue to understand the business logic in order to understand the author's intentions. 
   
   We can wait for more comments on this question.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on issue #446: Methods that continuously call WeakReference wrapper may throw an NPE

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on issue #446:
URL: https://github.com/apache/incubator-eventmesh/issues/446#issuecomment-882265272


   Yes, this does happen when the system gc occur, maybe we can use strong reference instead of weak reference.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org