You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2020/05/04 20:31:42 UTC

[shiro] branch 1.5.x updated: Mark `SecurityUtils.securityManager` as volatile

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

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


The following commit(s) were added to refs/heads/1.5.x by this push:
     new 7935aa8  Mark `SecurityUtils.securityManager` as volatile
7935aa8 is described below

commit 7935aa8506cb68bb8ecde47e474e88e1d5c0cb0c
Author: Boris Petrov <bo...@live.com>
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