226 LogManager mgr = manager;
227
228 // If the global handlers haven't been initialized yet, we
229 // don't want to initialize them just so we can close them!
230 synchronized (LogManager.this) {
231 // Note that death is imminent.
232 deathImminent = true;
233 initializedGlobalHandlers = true;
234 }
235
236 // Do a reset to close all active handlers.
237 reset();
238 }
239 }
240
241
242 /**
243 * Protected constructor. This is protected so that container applications
244 * (such as J2EE containers) can subclass the object. It is non-public as
245 * it is intended that there only be one LogManager object, whose value is
246 * retrieved by calling Logmanager.getLogManager.
247 */
248 protected LogManager() {
249 // Add a shutdown hook to close the global handlers.
250 try {
251 Runtime.getRuntime().addShutdownHook(new Cleaner());
252 } catch (IllegalStateException e) {
253 // If the VM is already shutting down,
254 // We do not need to register shutdownHook.
255 }
256 }
257
258 /**
259 * Return the global LogManager object.
260 */
261 public static LogManager getLogManager() {
262 if (manager != null) {
263 manager.readPrimordialConfiguration();
264 }
265 return manager;
266 }
|
226 LogManager mgr = manager;
227
228 // If the global handlers haven't been initialized yet, we
229 // don't want to initialize them just so we can close them!
230 synchronized (LogManager.this) {
231 // Note that death is imminent.
232 deathImminent = true;
233 initializedGlobalHandlers = true;
234 }
235
236 // Do a reset to close all active handlers.
237 reset();
238 }
239 }
240
241
242 /**
243 * Protected constructor. This is protected so that container applications
244 * (such as J2EE containers) can subclass the object. It is non-public as
245 * it is intended that there only be one LogManager object, whose value is
246 * retrieved by calling LogManager.getLogManager.
247 */
248 protected LogManager() {
249 // Add a shutdown hook to close the global handlers.
250 try {
251 Runtime.getRuntime().addShutdownHook(new Cleaner());
252 } catch (IllegalStateException e) {
253 // If the VM is already shutting down,
254 // We do not need to register shutdownHook.
255 }
256 }
257
258 /**
259 * Return the global LogManager object.
260 */
261 public static LogManager getLogManager() {
262 if (manager != null) {
263 manager.readPrimordialConfiguration();
264 }
265 return manager;
266 }
|