Adding the APIBuilder
The APIBuilder is an implementation for the MBeanServerBuilder that is used to instantiate the APIMBeanServer as the platform MBeanServer. Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
parent
4e02c52aee
commit
1daa5eb030
41
src/main/java/com/scylladb/jmx/utils/APIBuilder.java
Normal file
41
src/main/java/com/scylladb/jmx/utils/APIBuilder.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.scylladb.jmx.utils;
|
||||
/**
|
||||
* Copyright 2016 ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerDelegate;
|
||||
|
||||
import mx4j.server.ChainedMBeanServerBuilder;
|
||||
|
||||
public class APIBuilder extends ChainedMBeanServerBuilder {
|
||||
public APIBuilder() {
|
||||
super(new mx4j.server.MX4JMBeanServerBuilder());
|
||||
}
|
||||
|
||||
public MBeanServer newMBeanServer(String defaultDomain, MBeanServer outer,
|
||||
MBeanServerDelegate delegate) {
|
||||
APIMBeanServer extern = new APIMBeanServer();
|
||||
MBeanServer nested = getMBeanServerBuilder().newMBeanServer(
|
||||
defaultDomain, outer == null ? extern : outer, delegate);
|
||||
extern.setMBeanServer(nested);
|
||||
return extern;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user