Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServerBuilder.java
40948 views
1
/*
2
* Copyright (c) 2003, 2018, 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.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
package nsk.monitoring.share;
25
26
import javax.management.*;
27
28
/**
29
* The <code>CustomMBeanServerBuilder</code> class represents a builder that
30
* creates {@link CustomMBeanServer <tt>CustomMBeanServer</tt>} which is
31
* implemeted by NSK J2SE SQE Team to test Monitoring and Management API
32
* (JSR-174).
33
*
34
* <p>To instantiate <tt>CustomMBeanServer</tt>, the
35
* <b>javax.management.builder.initial</b> system property must contain
36
* <code>"nsk.monitoring.share.CustomMBeanServerBuilder"</code> string.
37
*/
38
public class CustomMBeanServerBuilder extends MBeanServerBuilder {
39
40
// NSK default domain
41
private static final String DEFAULT_DOMAIN = "nsk.defaultDomain";
42
43
/**
44
* Public default constructor.
45
*/
46
public CustomMBeanServerBuilder() {
47
super();
48
}
49
50
/**
51
* Creates a new <code>CustomMBeanServer</code> object.
52
*
53
* @param defaultDomain Default domain of the new MBean server.
54
* @param outer A pointer to the MBean server object that must be passed
55
* to the MBeans when invoking their
56
* {@link javax.management.MBeanRegistration
57
* <code>MBeanRegistration</code>} interface.
58
* @param delegate A pointer to the MBeanServerDelegate associated with
59
* the new MBeanServer. The new MBeanServer must register this
60
* MBean in its MBean repository.
61
*
62
* @return A new <code>CustomMBeanServer</code> instance.
63
*
64
* @see javax.management.MBeanServerBuilder#newMBeanServer
65
*/
66
public MBeanServer newMBeanServer(String defaultDomain,
67
MBeanServer outer,
68
MBeanServerDelegate delegate) {
69
if (defaultDomain == null || defaultDomain.length() == 0)
70
return new CustomMBeanServer(DEFAULT_DOMAIN);
71
else
72
return new CustomMBeanServer(defaultDomain);
73
}
74
75
/**
76
* Creates an instance of the {@link javax.management.MBeanServerDelegate
77
* <code>MBeanServerDelegate</code>} class.
78
*
79
* @return A new <code>MBeanServerDelegate</code> object.
80
*
81
* @see javax.management.MBeanServerBuilder#newMBeanServerDelegate
82
*/
83
public MBeanServerDelegate newMBeanServerDelegate() {
84
return new MBeanServerDelegate();
85
}
86
}
87
88