1 28 29 30 package com.caucho.tools.profiler; 31 32 import com.caucho.jmx.Jmx; 33 import com.caucho.util.L10N; 34 35 import javax.management.ObjectName ; 36 import javax.management.openmbean.TabularData ; 37 import java.util.logging.Level ; 38 import java.util.logging.Logger ; 39 40 public class ProfilerAdmin 41 implements ProfilerMBean 42 { 43 private static final L10N L = new L10N(ProfilerAdmin.class); 44 private static final Logger log = Logger.getLogger(ProfilerAdmin.class.getName()); 45 46 private final ProfilerManager _profilerManager; 47 private final ObjectName _objectName; 48 49 ProfilerAdmin(ProfilerManager profilerManager) 50 { 51 _profilerManager = profilerManager; 52 53 ObjectName objectName; 54 55 try { 56 objectName = Jmx.getObjectName("type=Profiler"); 57 58 objectName = new ObjectName (objectName.getCanonicalName()); 59 60 Jmx.register(this, objectName); 61 } 62 catch (Throwable e) { 63 objectName = null; 64 65 log.log(Level.FINER, e.toString(), e); 66 } 67 68 _objectName = objectName; 69 } 70 71 public ObjectName getObjectName() 72 { 73 return _objectName; 74 } 75 76 public boolean isEnabled() 77 { 78 return _profilerManager.isEnabled(); 79 } 80 81 public void enable() 82 { 83 _profilerManager.enable(); 84 } 85 86 public void disable() 87 { 88 _profilerManager.disable(); 89 } 90 91 public void reset() 92 { 93 _profilerManager.reset(); 94 } 95 96 98 public TabularData snapshot() 99 { 100 return null; 101 } 102 103 198 199 } 200 | Popular Tags |