1 22 package org.jboss.varia.scheduler.example; 23 24 import java.security.InvalidParameterException ; 25 import java.util.Date ; 26 27 import javax.management.MalformedObjectNameException ; 28 import javax.management.MBeanServer ; 29 import javax.management.Notification ; 30 import javax.management.timer.TimerNotification ; 31 import javax.management.NotificationFilter ; 32 import javax.management.NotificationListener ; 33 import javax.management.ObjectName ; 34 35 import org.jboss.logging.Logger; 36 import org.jboss.system.ServiceMBeanSupport; 37 38 import org.jboss.varia.scheduler.Schedulable; 39 40 50 public class SchedulableMBeanExample 51 extends ServiceMBeanSupport 52 implements SchedulableMBeanExampleMBean 53 { 54 55 private Notification notification; 56 private Date date; 57 private long repetitions; 58 private ObjectName name; 59 private String test; 60 private int hitCount; 61 62 66 70 public void hit(Notification notification, Date date, long repetitions, ObjectName name, String test) 71 { 72 log.info("got hit"); 73 this.notification = notification; 74 this.date = date; 75 this.repetitions = repetitions; 76 this.name = name; 77 this.test = test; 78 hitCount++; 79 log.info(this.toString()); 80 } 81 82 86 public int getHitCount() 87 { 88 return hitCount; 89 } 90 91 95 public Date getHitDate() 96 { 97 return date; 98 } 99 100 104 public Notification getHitNotification() 105 { 106 return notification; 107 } 108 109 113 public long getRemainingRepetitions() 114 { 115 return repetitions; 116 } 117 118 122 public ObjectName getSchedulerName() 123 { 124 return name; 125 } 126 127 131 public String getTestString() 132 { 133 return test; 134 } 135 136 139 public String toString() { 140 return super.toString() 141 + " name=" + getName() 142 + " hitCount=" + hitCount 143 + " notification=" + notification 144 + " date=" + date 145 + " repetitions=" + repetitions 146 + " name=" + name 147 + " test string=" + test; 148 } 149 } 150 | Popular Tags |