111 });
112 }
113
114 /*
115 * Load debug properties from file, then override
116 * with any command line specified properties
117 */
118 private synchronized void loadProperties() {
119 // setup initial properties
120 java.security.AccessController.doPrivileged(
121 new java.security.PrivilegedAction<Void>() {
122 public Void run() {
123 loadDefaultProperties();
124 loadFileProperties();
125 loadSystemProperties();
126 return null;
127 }
128 });
129
130 // echo the initial property settings to stdout
131 if (log.isLoggable(PlatformLogger.FINE)) {
132 log.fine("DebugSettings:\n{0}", this);
133 }
134 }
135
136 public String toString() {
137 ByteArrayOutputStream bout = new ByteArrayOutputStream();
138 PrintStream pout = new PrintStream(bout);
139 for (String key : props.stringPropertyNames()) {
140 String value = props.getProperty(key, "");
141 pout.println(key + " = " + value);
142 }
143 return new String(bout.toByteArray());
144 }
145
146 /*
147 * Sets up default property values
148 */
149 private void loadDefaultProperties() {
150 // is there a more inefficient way to setup default properties?
151 // maybe, but this has got to be close to 100% non-optimal
233 * @return string value of the named property
234 */
235 public synchronized String getString(String key, String defval) {
236 String actualKeyName = PREFIX + "." + key;
237 String value = props.getProperty(actualKeyName, defval);
238 //println(actualKeyName+"="+value);
239 return value;
240 }
241
242 private synchronized List<String> getPropertyNames() {
243 List<String> propNames = new LinkedList<>();
244 // remove global prefix from property names
245 for (String propName : props.stringPropertyNames()) {
246 propName = propName.substring(PREFIX.length()+1);
247 propNames.add(propName);
248 }
249 return propNames;
250 }
251
252 private void println(Object object) {
253 if (log.isLoggable(PlatformLogger.FINER)) {
254 log.finer(object.toString());
255 }
256 }
257
258 private static final String PROP_CTRACE = "ctrace";
259 private static final int PROP_CTRACE_LEN = PROP_CTRACE.length();
260
261 private native synchronized void setCTracingOn(boolean enabled);
262 private native synchronized void setCTracingOn(boolean enabled, String file);
263 private native synchronized void setCTracingOn(boolean enabled, String file, int line);
264
265 private void loadNativeSettings() {
266 boolean ctracingOn;
267
268 ctracingOn = getBoolean(PROP_CTRACE, false);
269 setCTracingOn(ctracingOn);
270
271 //
272 // Filter out file/line ctrace properties from debug settings
273 //
|
111 });
112 }
113
114 /*
115 * Load debug properties from file, then override
116 * with any command line specified properties
117 */
118 private synchronized void loadProperties() {
119 // setup initial properties
120 java.security.AccessController.doPrivileged(
121 new java.security.PrivilegedAction<Void>() {
122 public Void run() {
123 loadDefaultProperties();
124 loadFileProperties();
125 loadSystemProperties();
126 return null;
127 }
128 });
129
130 // echo the initial property settings to stdout
131 if (log.isLoggable(PlatformLogger.Level.FINE)) {
132 log.fine("DebugSettings:\n{0}", this);
133 }
134 }
135
136 public String toString() {
137 ByteArrayOutputStream bout = new ByteArrayOutputStream();
138 PrintStream pout = new PrintStream(bout);
139 for (String key : props.stringPropertyNames()) {
140 String value = props.getProperty(key, "");
141 pout.println(key + " = " + value);
142 }
143 return new String(bout.toByteArray());
144 }
145
146 /*
147 * Sets up default property values
148 */
149 private void loadDefaultProperties() {
150 // is there a more inefficient way to setup default properties?
151 // maybe, but this has got to be close to 100% non-optimal
233 * @return string value of the named property
234 */
235 public synchronized String getString(String key, String defval) {
236 String actualKeyName = PREFIX + "." + key;
237 String value = props.getProperty(actualKeyName, defval);
238 //println(actualKeyName+"="+value);
239 return value;
240 }
241
242 private synchronized List<String> getPropertyNames() {
243 List<String> propNames = new LinkedList<>();
244 // remove global prefix from property names
245 for (String propName : props.stringPropertyNames()) {
246 propName = propName.substring(PREFIX.length()+1);
247 propNames.add(propName);
248 }
249 return propNames;
250 }
251
252 private void println(Object object) {
253 if (log.isLoggable(PlatformLogger.Level.FINER)) {
254 log.finer(object.toString());
255 }
256 }
257
258 private static final String PROP_CTRACE = "ctrace";
259 private static final int PROP_CTRACE_LEN = PROP_CTRACE.length();
260
261 private native synchronized void setCTracingOn(boolean enabled);
262 private native synchronized void setCTracingOn(boolean enabled, String file);
263 private native synchronized void setCTracingOn(boolean enabled, String file, int line);
264
265 private void loadNativeSettings() {
266 boolean ctracingOn;
267
268 ctracingOn = getBoolean(PROP_CTRACE, false);
269 setCTracingOn(ctracingOn);
270
271 //
272 // Filter out file/line ctrace properties from debug settings
273 //
|