313233343536373839
private Monitor monitor = null; public Monitor createMonitor() { if (monitor == null) { monitor = new MonitorImpl(); } return monitor ; }
28293031323334
*/ public class DefaultMonitorFactory implements MonitorFactory { private ThreadLocal<Monitor> contextMonitor = new InheritableThreadLocal<Monitor>(); public Monitor createMonitor() { return new MonitorImpl(); }
38394041424344454647
} public Monitor getContextMonitor(boolean create) { Monitor monitor = contextMonitor.get(); if (monitor == null) { monitor = new MonitorImpl(); setContextMonitor(monitor); } return monitor; }