1 22 package org.jboss.services.loggingmonitor; 23 24 import java.util.TimerTask ; 25 26 import org.jboss.logging.Logger; 27 28 29 37 class LoggingMonitorTimerTask extends TimerTask 38 { 39 private MonitoredMBean[] monitoredObjects; 40 private Logger logger; 41 42 48 public LoggingMonitorTimerTask(MonitoredMBean[] monitoredObjects, Logger logger) 49 { 50 this.monitoredObjects = monitoredObjects; 51 this.logger = logger; 52 53 for (int i = 0; i < monitoredObjects.length; ++i) 54 { 55 monitoredObjects[i].logFormat(); 57 } 58 } 59 60 63 public void run() 64 { 65 for (int i = 0; i < monitoredObjects.length; ++i) 66 { 67 try 68 { 69 monitoredObjects[i].logAttributes(); 70 } 71 catch (Exception e) 72 { 73 logger.warn("Unable to log attributes for mbean: " + monitoredObjects[i].getObjectName(), e); 74 } 75 } 76 } 77 } 78 | Popular Tags |