< prev index next >

src/java.base/share/classes/java/lang/SecurityManager.java

Print this page




1097      * invalidate the cache.
1098      *
1099      * Locking is handled by synchronization to the
1100      * packageAccessLock/packageDefinitionLock objects.  They are only
1101      * used in this class.
1102      *
1103      * Note that cache invalidation as a result of the property change
1104      * happens without using these locks, so there may be a delay between
1105      * when a thread updates the property and when other threads updates
1106      * the cache.
1107      */
1108     private static boolean packageAccessValid = false;
1109     private static String[] packageAccess;
1110     private static final Object packageAccessLock = new Object();
1111 
1112     private static boolean packageDefinitionValid = false;
1113     private static String[] packageDefinition;
1114     private static final Object packageDefinitionLock = new Object();
1115 
1116     private static String[] getPackages(String p) {
1117         String packages[] = null;
1118         if (p != null && !p.equals("")) {
1119             java.util.StringTokenizer tok =
1120                 new java.util.StringTokenizer(p, ",");
1121             int n = tok.countTokens();
1122             if (n > 0) {
1123                 packages = new String[n];
1124                 int i = 0;
1125                 while (tok.hasMoreElements()) {
1126                     String s = tok.nextToken().trim();
1127                     packages[i++] = s;
1128                 }
1129             }
1130         }
1131 
1132         if (packages == null) {
1133             packages = new String[0];
1134         }
1135         return packages;
1136     }
1137 




1097      * invalidate the cache.
1098      *
1099      * Locking is handled by synchronization to the
1100      * packageAccessLock/packageDefinitionLock objects.  They are only
1101      * used in this class.
1102      *
1103      * Note that cache invalidation as a result of the property change
1104      * happens without using these locks, so there may be a delay between
1105      * when a thread updates the property and when other threads updates
1106      * the cache.
1107      */
1108     private static boolean packageAccessValid = false;
1109     private static String[] packageAccess;
1110     private static final Object packageAccessLock = new Object();
1111 
1112     private static boolean packageDefinitionValid = false;
1113     private static String[] packageDefinition;
1114     private static final Object packageDefinitionLock = new Object();
1115 
1116     private static String[] getPackages(String p) {
1117         String[] packages = null;
1118         if (p != null && !p.equals("")) {
1119             java.util.StringTokenizer tok =
1120                 new java.util.StringTokenizer(p, ",");
1121             int n = tok.countTokens();
1122             if (n > 0) {
1123                 packages = new String[n];
1124                 int i = 0;
1125                 while (tok.hasMoreElements()) {
1126                     String s = tok.nextToken().trim();
1127                     packages[i++] = s;
1128                 }
1129             }
1130         }
1131 
1132         if (packages == null) {
1133             packages = new String[0];
1134         }
1135         return packages;
1136     }
1137 


< prev index next >