package jp.gr.java_conf.skrb.game.trivia.mserver; import javax.management.AttributeChangeNotification; import javax.management.MBeanNotificationInfo; import javax.management.NotificationBroadcasterSupport; public class TriviaServerNotification extends NotificationBroadcasterSupport implements TriviaServerNotificationMBean { private TriviaServerInstrument instrument; public TriviaServerNotification() { instrument = new TriviaServerInstrument(); } public int getClientSize() { return instrument.getClientSize(); } public int getTotalCount() { return instrument.getTotalCount(); } public void setTotalCount(int count) { instrument.setTotalCount(count); } public String[] getClients() { return instrument.getClients(); } public int getCount(String name) { return instrument.getCount(name); } public void reset() { AttributeChangeNotification notification = new AttributeChangeNotification(this, 0, 0, "Trivia Server Reset", "TotalCount", "int", new Integer(instrument.getTotalCount()), new Integer(0)); instrument.reset(); sendNotification(notification); } public MBeanNotificationInfo[] getNotificationInfo() { return new MBeanNotificationInfo[] { new MBeanNotificationInfo(new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE }, AttributeChangeNotification.class.getName(), "This notification is emitted when the reset() method is called.") }; } }