This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/master by this push:
     new b80b767  Mark `SecurityUtils.securityManager` as volatile
     new 2b3e583  Merge pull request #218 from boris-petrov/add-volatile
b80b767 is described below

commit b80b7677e193c79068f40b91d97b30b0ff5c9775
Author: Boris Petrov <[email protected]>
AuthorDate: Thu Apr 30 11:48:30 2020 +0300

    Mark `SecurityUtils.securityManager` as volatile
    
    As it can be modified and read by different threads
---
 core/src/main/java/org/apache/shiro/SecurityUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/shiro/SecurityUtils.java 
b/core/src/main/java/org/apache/shiro/SecurityUtils.java
index d78ab07..058ccf4 100644
--- a/core/src/main/java/org/apache/shiro/SecurityUtils.java
+++ b/core/src/main/java/org/apache/shiro/SecurityUtils.java
@@ -34,7 +34,7 @@ public abstract class SecurityUtils {
      * ONLY used as a 'backup' in VM Singleton environments (that is, 
standalone environments), since the
      * ThreadContext should always be the primary source for Subject instances 
when possible.
      */
-    private static SecurityManager securityManager;
+    private static volatile SecurityManager securityManager;
 
     /**
      * Returns the currently accessible {@code Subject} available to the 
calling code depending on

Reply via email to