KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > compliance > server > support > LockedTest3


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

7
8 package test.compliance.server.support;
9
10 import javax.management.MBeanRegistration;
11 import javax.management.MBeanRegistrationException;
12 import javax.management.MBeanServer;
13 import javax.management.ObjectName;
14
15 /**
16  * MBean that disallows unregistration by throwing a checked exception from its
17  * <tt>preDeregister()</tt> method.
18  *
19  * @author <a HREF="mailto:juha@jboss.org">Juha Lindfors</a>.
20  * @version $Revision: 1.2 $
21  *
22  */

23 public class LockedTest3
24          implements LockedTest3MBean, MBeanRegistration
25 {
26
27    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
28    {
29       return name;
30    }
31    
32    public void postRegister(Boolean b)
33    {
34    
35    }
36    
37    public void preDeregister() throws Exception
38    {
39       throw new MBeanRegistrationException(new MyScreamingException(), "you can't unregister me!");
40    }
41    
42    public void postDeregister()
43    {
44    
45    }
46 }
47
48
49
50
51
Popular Tags