Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.management/share/classes/javax/management/MBeanRegistration.java
41154 views
1
/*
2
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.management;
27
28
29
/**
30
* <p>Can be implemented by an MBean in order to
31
* carry out operations before and after being registered or unregistered from
32
* the MBean Server. An MBean can also implement this interface in order
33
* to get a reference to the MBean Server and/or its name within that
34
* MBean Server.</p>
35
*
36
* @since 1.5
37
*/
38
public interface MBeanRegistration {
39
40
41
/**
42
* Allows the MBean to perform any operations it needs before
43
* being registered in the MBean Server. If the name of the MBean
44
* is not specified, the MBean can provide a name for its
45
* registration. If any exception is raised, the MBean will not be
46
* registered in the MBean Server.
47
*
48
* @param server The MBean Server in which the MBean will be registered.
49
*
50
* @param name The object name of the MBean. This name is null if
51
* the name parameter to one of the <code>createMBean</code> or
52
* <code>registerMBean</code> methods in the {@link MBeanServer}
53
* interface is null. In that case, this method must return a
54
* non-null ObjectName for the new MBean.
55
*
56
* @return The name under which the MBean is to be registered.
57
* This value must not be null. If the <code>name</code>
58
* parameter is not null, it will usually but not necessarily be
59
* the returned value.
60
*
61
* @exception java.lang.Exception This exception will be caught by
62
* the MBean Server and re-thrown as an {@link
63
* MBeanRegistrationException}.
64
*/
65
public ObjectName preRegister(MBeanServer server,
66
ObjectName name) throws java.lang.Exception;
67
68
/**
69
* Allows the MBean to perform any operations needed after having been
70
* registered in the MBean server or after the registration has failed.
71
* <p>If the implementation of this method throws a {@link RuntimeException}
72
* or an {@link Error}, the MBean Server will rethrow those inside
73
* a {@link RuntimeMBeanException} or {@link RuntimeErrorException},
74
* respectively. However, throwing an exception in {@code postRegister}
75
* will not change the state of the MBean:
76
* if the MBean was already registered ({@code registrationDone} is
77
* {@code true}), the MBean will remain registered. </p>
78
* <p>This might be confusing for the code calling {@code createMBean()}
79
* or {@code registerMBean()}, as such code might assume that MBean
80
* registration has failed when such an exception is raised.
81
* Therefore it is recommended that implementations of
82
* {@code postRegister} do not throw Runtime Exceptions or Errors if it
83
* can be avoided.</p>
84
* @param registrationDone Indicates whether or not the MBean has
85
* been successfully registered in the MBean server. The value
86
* false means that the registration phase has failed.
87
*/
88
public void postRegister(Boolean registrationDone);
89
90
/**
91
* Allows the MBean to perform any operations it needs before
92
* being unregistered by the MBean server.
93
*
94
* @exception java.lang.Exception This exception will be caught by
95
* the MBean server and re-thrown as an {@link
96
* MBeanRegistrationException}.
97
*/
98
public void preDeregister() throws java.lang.Exception ;
99
100
/**
101
* Allows the MBean to perform any operations needed after having been
102
* unregistered in the MBean server.
103
* <p>If the implementation of this method throws a {@link RuntimeException}
104
* or an {@link Error}, the MBean Server will rethrow those inside
105
* a {@link RuntimeMBeanException} or {@link RuntimeErrorException},
106
* respectively. However, throwing an exception in {@code postDeregister}
107
* will not change the state of the MBean:
108
* the MBean was already successfully deregistered and will remain so. </p>
109
* <p>This might be confusing for the code calling
110
* {@code unregisterMBean()}, as it might assume that MBean deregistration
111
* has failed. Therefore it is recommended that implementations of
112
* {@code postDeregister} do not throw Runtime Exceptions or Errors if it
113
* can be avoided.</p>
114
*/
115
public void postDeregister();
116
117
}
118
119