equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
69 * system property to 'true': sun.awt.nativedebug. After |
69 * system property to 'true': sun.awt.nativedebug. After |
70 * the native logging is enabled, the actual debug settings |
70 * the native logging is enabled, the actual debug settings |
71 * are read the same way as described above (as before |
71 * are read the same way as described above (as before |
72 * the fix for 4638447). |
72 * the fix for 4638447). |
73 */ |
73 */ |
74 final class DebugSettings { |
74 public final class DebugSettings { |
75 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings"); |
75 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings"); |
76 |
76 |
77 /* standard debug property key names */ |
77 /* standard debug property key names */ |
78 static final String PREFIX = "awtdebug"; |
78 static final String PREFIX = "awtdebug"; |
79 static final String PROP_FILE = "properties"; |
79 static final String PROP_FILE = "properties"; |
85 "awtdebug.on=true", |
85 "awtdebug.on=true", |
86 "awtdebug.ctrace=false" |
86 "awtdebug.ctrace=false" |
87 }; |
87 }; |
88 |
88 |
89 /* global instance of the settings object */ |
89 /* global instance of the settings object */ |
90 private static DebugSettings instance = null; |
90 private static final DebugSettings instance = new DebugSettings(); |
91 |
91 |
92 private Properties props = new Properties(); |
92 private final Properties props = new Properties(); |
93 |
93 |
94 static void init() { |
94 static synchronized void init() { |
95 if (instance != null) { |
95 if (!instance.props.isEmpty()) { |
96 return; |
96 return; |
97 } |
97 } |
98 |
|
99 NativeLibLoader.loadLibraries(); |
98 NativeLibLoader.loadLibraries(); |
100 instance = new DebugSettings(); |
99 instance.loadProperties(); |
101 instance.loadNativeSettings(); |
100 instance.loadNativeSettings(); |
102 } |
101 } |
103 |
102 |
104 private DebugSettings() { |
103 public static DebugSettings getInstance() { |
105 java.security.AccessController.doPrivileged( |
104 return instance; |
106 new java.security.PrivilegedAction<Void>() { |
|
107 public Void run() { |
|
108 loadProperties(); |
|
109 return null; |
|
110 } |
|
111 }); |
|
112 } |
105 } |
113 |
106 |
114 /* |
107 /* |
115 * Load debug properties from file, then override |
108 * Load debug properties from file, then override |
116 * with any command line specified properties |
109 * with any command line specified properties |