KickJava   Java API By Example, From Geeks To Geeks.

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


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.MBeanServer;
12 import javax.management.ObjectName;
13
14 /**
15  * MBean that disallows unregistration by throwing an exception from its
16  * <tt>preDeregister()</tt> method.
17  *
18  * @author <a HREF="mailto:juha@jboss.org">Juha Lindfors</a>.
19  * @version $Revision: 1.2 $
20  *
21  */

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