本文整理匯總了Java中javax.management.MBeanRegistrationException類的典型用法代碼示例。如果您正苦於以下問題:Java MBeanRegistrationException類的具體用法?Java MBeanRegistrationException怎麽用?Java MBeanRegistrationException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MBeanRegistrationException類屬於javax.management包,在下文中一共展示了MBeanRegistrationException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public static void registerMBean(final String mBeanObjectName,final Object mBean)
{
try
{
final ObjectName name = new ObjectName(mBeanObjectName);
mbs.registerMBean(mBean, name);
}
catch (MalformedObjectNameException badObjectName)
{
logger.error(badObjectName.getMessage());
}
catch (InstanceAlreadyExistsException duplicateMBeanInstance)
{
logger.error(duplicateMBeanInstance.getMessage());
}
catch (MBeanRegistrationException mbeanRegistrationProblem)
{
logger.error(mbeanRegistrationProblem.getMessage());
}
catch (NotCompliantMBeanException badMBean)
{
logger.error(badMBean.getMessage());
}
}
示例2: init
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public boolean init() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {
//Initialize SPARQL 1.1 processing service properties
endpointProperties = new SPARQL11Properties("endpoint.jpar");
//Initialize SPARQL 1.1 SE processing service properties
engineProperties = new EngineProperties("engine.jpar");
//SPARQL 1.1 SE request processor
processor = new Processor(endpointProperties);
//SPARQL 1.1 SE request scheduler
scheduler = new Scheduler(engineProperties,processor);
//SPARQL 1.1 Protocol handlers
httpGate = new HTTPGate(engineProperties,scheduler);
httpsGate = new HTTPSGate(engineProperties,scheduler,am);
//SPARQL 1.1 SE Protocol handler for WebSocket based subscriptions
websocketApp = new WSGate(engineProperties,scheduler);
secureWebsocketApp = new WSSGate(engineProperties,scheduler,am);
return true;
}
示例3: preRegister
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
private static ObjectName preRegister(
DynamicMBean mbean, MBeanServer mbs, ObjectName name)
throws InstanceAlreadyExistsException, MBeanRegistrationException {
ObjectName newName = null;
try {
if (mbean instanceof MBeanRegistration)
newName = ((MBeanRegistration) mbean).preRegister(mbs, name);
} catch (Throwable t) {
throwMBeanRegistrationException(t, "in preRegister method");
}
if (newName != null) return newName;
else return name;
}
示例4: addDynamicMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
/**
* Registers a DynamicMBean.
*/
private static void addDynamicMBean(final MBeanServer mbs,
final DynamicMBean dmbean,
final ObjectName on) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws InstanceAlreadyExistsException,
MBeanRegistrationException,
NotCompliantMBeanException {
mbs.registerMBean(dmbean, on);
return null;
}
});
} catch (PrivilegedActionException e) {
throw new RuntimeException(e.getException());
}
}
示例5: createMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public ObjectInstance createMBean(String className, ObjectName name,
Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException {
try {
return createMBean(className, name, null, true,
params, signature);
} catch (InstanceNotFoundException e) {
/* Can only happen if loaderName doesn't exist, but we just
passed null, so we shouldn't get this exception. */
throw EnvHelp.initCause(
new IllegalArgumentException("Unexpected exception: " + e), e);
}
}
示例6: registerMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public ObjectInstance registerMBean(Object object, ObjectName name)
throws InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException {
// ------------------------------
// ------------------------------
Class<?> theClass = object.getClass();
Introspector.checkCompliance(theClass);
final String infoClassName = getNewMBeanClassName(object);
checkMBeanPermission(infoClassName, null, name, "registerMBean");
checkMBeanTrustPermission(theClass);
return registerObject(infoClassName, object, name);
}
示例7: doTest
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
private void doTest(JMXConnector connector) throws IOException,
MalformedObjectNameException, ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
System.out.println("DEBUG: Calling createMBean");
mbsc.createMBean(Name.class.getName(), objName);
System.out.println("DEBUG: Calling setAttributes");
AttributeList attList = new AttributeList();
attList.add(new Attribute("FirstName", ANY_NAME));
attList.add(new Attribute("LastName", ANY_NAME));
mbsc.setAttributes(objName, attList);
}
示例8: createMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
/**
* Call <code>checkCreate(className)</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance createMBean(String className, ObjectName name)
throws
ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException {
checkCreate(className);
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
Object object = getMBeanServer().instantiate(className);
checkClassLoader(object);
return getMBeanServer().registerMBean(object, name);
} else {
return getMBeanServer().createMBean(className, name);
}
}
示例9: createMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
/**
* Call <code>checkCreate(className)</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName)
throws
ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException {
checkCreate(className);
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
Object object = getMBeanServer().instantiate(className,
loaderName);
checkClassLoader(object);
return getMBeanServer().registerMBean(object, name);
} else {
return getMBeanServer().createMBean(className, name, loaderName);
}
}
示例10: throwMBeanRegistrationException
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
if (t instanceof RuntimeException) {
throw new RuntimeMBeanException((RuntimeException)t,
"RuntimeException thrown " + where);
} else if (t instanceof Error) {
throw new RuntimeErrorException((Error)t,
"Error thrown " + where);
} else if (t instanceof MBeanRegistrationException) {
throw (MBeanRegistrationException)t;
} else if (t instanceof Exception) {
throw new MBeanRegistrationException((Exception)t,
"Exception thrown " + where);
} else // neither Error nor Exception??
throw new RuntimeException(t);
}
示例11: unregisterMBean
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public void unregisterMBean(ObjectName name)
throws InstanceNotFoundException,
MBeanRegistrationException,
IOException {
if (logger.debugOn())
logger.debug("unregisterMBean", "name=" + name);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.unregisterMBean(name, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.unregisterMBean(name, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例12: Scheduler
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public Scheduler(EngineProperties properties,Processor processor) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
requestHandler = new RequestResponseHandler(properties);
tokenHandler = new TokenHandler(properties);
if (processor == null) logger.error("Processor is null");
else {
this.processor = processor;
this.processor.addObserver(this);
}
}
示例13: main
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
public static void main(String[] args) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {
System.out.println("##########################################################################################");
System.out.println("# SEPA Engine Ver 0.6 Copyright (C) 2016-2017 #");
System.out.println("# University of Bologna (Italy) #");
System.out.println("# #");
System.out.println("# This program comes with ABSOLUTELY NO WARRANTY #");
System.out.println("# This is free software, and you are welcome to redistribute it under certain conditions #");
System.out.println("# GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 #");
System.out.println("# #");
System.out.println("# GitHub: https://github.com/vaimee/sepatools #");
System.out.println("# Web: http://wot.arces.unibo.it #");
System.out.println("##########################################################################################");
System.out.println("");
System.out.println("Dependencies");
System.out.println("com.google.code.gson 2.8.0 Apache 2.0");
System.out.println("com.nimbusds 4.34.2 The Apache Software License, Version 2.0");
System.out.println("commons-io 2.5 Apache License, Version 2.0");
System.out.println("commons-logging 1.2 The Apache Software License, Version 2.0");
System.out.println("org.apache.httpcomponents 4.5.3 Apache License, Version 2.0");
System.out.println("org.apache.httpcomponents 4.4.6 Apache License, Version 2.0");
System.out.println("org.apache.logging.log4j 2.8.1 Apache License, Version 2.0");
System.out.println("org.bouncycastle 1.56 Bouncy Castle Licence");
System.out.println("org.eclipse.paho 1.1.1 Eclipse Public License - Version 1.0");
System.out.println("org.glassfish.grizzly 2.3.30 CDDL+GPL");
System.out.println("org.glassfish.tyrus.bundles 1.13.1 Dual license consisting of the CDDL v1.1 and GPL v2");
System.out.println("org.jdom 2.0.6 Similar to Apache License but with the acknowledgment clause removed");
System.out.println("");
//Engine creation and initialization
Engine engine = new Engine();
engine.init();
//Starting main engine thread
engine.start();
}
示例14: JMXFlagDecorator
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
/**
*
* @param flag Flag to be exposed through JMX.
* @param source MBean or ObjectName of the object where the flag resides.
* @param nbs NotificationBroadcasterSupport through which the events will be send.
*/
public JMXFlagDecorator(Flag<T> flag, ObjectName source, MBeanServer mbs, String flagName) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
this.flag = flag;
this.source = source;
this.flagName = flagName;
ObjectName name = PogamutJMX.getObjectName(source, flagName, PogamutJMX.FLAGS_SUBTYPE);
mbs.registerMBean(this, name);
flag.addListener(listener);
}
示例15: handleNotification
import javax.management.MBeanRegistrationException; //導入依賴的package包/類
@Override
public void handleNotification(final Notification notification, final Object handback) {
if (notification instanceof MBeanServerNotification
&& notification.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)
&& ((MBeanServerNotification) notification).getMBeanName().equals(objectNameInternal)) {
try {
internalServer.unregisterMBean(objectNameInternal);
configMBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this);
} catch (MBeanRegistrationException | ListenerNotFoundException | InstanceNotFoundException e) {
throw new IllegalStateException(e);
}
}
}