KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > compliance > core > notification > BadListener


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package test.compliance.core.notification;
8
9 import javax.management.Notification JavaDoc;
10 import javax.management.NotificationListener JavaDoc;
11
12 /**
13  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
14  */

15 public class BadListener implements NotificationListener JavaDoc
16 {
17    int count;
18
19    public int getCount()
20    {
21       return count;
22    }
23
24    public void handleNotification(Notification JavaDoc event, Object JavaDoc handback)
25    {
26       System.out.println("BadListener handleNotification, event: " + event + ", count=" + count);
27       count++;
28       try
29       {
30          System.out.println("Sleeping 30 seconds...");
31          Thread.sleep(30 * 1000);
32       }
33       catch(InterruptedException JavaDoc e)
34       {
35          e.printStackTrace();
36       }
37       System.out.println("Awake");
38    }
39 }
40
Popular Tags