本文整理匯總了Java中javax.management.MBeanRegistration類的典型用法代碼示例。如果您正苦於以下問題:Java MBeanRegistration類的具體用法?Java MBeanRegistration怎麽用?Java MBeanRegistration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MBeanRegistration類屬於javax.management包,在下文中一共展示了MBeanRegistration類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: preRegister
import javax.management.MBeanRegistration; //導入依賴的package包/類
/**
* Is the specified <code>ModelMBeanInfo</code> instance valid?
*
* <p><strong>IMPLEMENTATION NOTE</strong> - This implementation
* does not check anything, but this method can be overridden
* as required.</p>
*
* @param info The <code>ModelMBeanInfo object to check
*/
// protected boolean isModelMBeanInfoValid(ModelMBeanInfo info) {
// return (true);
// }
// -------------------- Registration --------------------
// XXX We can add some method patterns here- like setName() and
// setDomain() for code that doesn't implement the Registration
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
{
if( log.isDebugEnabled())
log.debug("preRegister " + resource + " " + name );
oname=name;
if( resource instanceof MBeanRegistration ) {
oname = ((MBeanRegistration)resource).preRegister(server, name );
}
return oname;
}
示例2: preRegister
import javax.management.MBeanRegistration; //導入依賴的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;
}
示例3: postRegister
import javax.management.MBeanRegistration; //導入依賴的package包/類
private static void postRegister(
ObjectName logicalName, DynamicMBean mbean,
boolean registrationDone, boolean registerFailed) {
if (registerFailed && mbean instanceof DynamicMBean2)
((DynamicMBean2) mbean).registerFailed();
try {
if (mbean instanceof MBeanRegistration)
((MBeanRegistration) mbean).postRegister(registrationDone);
} catch (RuntimeException e) {
MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
"]: " + "Exception thrown by postRegister: " +
"rethrowing <"+e+">, but keeping the MBean registered");
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postRegister method: "+
"rethrowing <"+e+">, but keeping the MBean registered");
} catch (Error er) {
MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
"]: " + "Error thrown by postRegister: " +
"rethrowing <"+er+">, but keeping the MBean registered");
throw new RuntimeErrorException(er,
"Error thrown in postRegister method: "+
"rethrowing <"+er+">, but keeping the MBean registered");
}
}
示例4: postDeregisterInvoke
import javax.management.MBeanRegistration; //導入依賴的package包/類
private static void postDeregisterInvoke(ObjectName mbean,
MBeanRegistration moi) {
try {
moi.postDeregister();
} catch (RuntimeException e) {
MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
"]: " + "Exception thrown by postDeregister: " +
"rethrowing <"+e+">, although the MBean is succesfully " +
"unregistered");
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postDeregister method: "+
"rethrowing <"+e+
">, although the MBean is sucessfully unregistered");
} catch (Error er) {
MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
"]: " + "Error thrown by postDeregister: " +
"rethrowing <"+er+">, although the MBean is succesfully " +
"unregistered");
throw new RuntimeErrorException(er,
"Error thrown in postDeregister method: "+
"rethrowing <"+er+
">, although the MBean is sucessfully unregistered");
}
}
示例5: postRegister
import javax.management.MBeanRegistration; //導入依賴的package包/類
private static void postRegister(
ObjectName logicalName, DynamicMBean mbean,
boolean registrationDone, boolean registerFailed) {
if (registerFailed && mbean instanceof DynamicMBean2)
((DynamicMBean2) mbean).registerFailed();
try {
if (mbean instanceof MBeanRegistration)
((MBeanRegistration) mbean).postRegister(registrationDone);
} catch (RuntimeException e) {
MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+
"]: " + "Exception thrown by postRegister: " +
"rethrowing <"+e+">, but keeping the MBean registered");
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postRegister method: "+
"rethrowing <"+e+">, but keeping the MBean registered");
} catch (Error er) {
MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+
"]: " + "Error thrown by postRegister: " +
"rethrowing <"+er+">, but keeping the MBean registered");
throw new RuntimeErrorException(er,
"Error thrown in postRegister method: "+
"rethrowing <"+er+">, but keeping the MBean registered");
}
}
示例6: postDeregisterInvoke
import javax.management.MBeanRegistration; //導入依賴的package包/類
private static void postDeregisterInvoke(ObjectName mbean,
MBeanRegistration moi) {
try {
moi.postDeregister();
} catch (RuntimeException e) {
MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
"]: " + "Exception thrown by postDeregister: " +
"rethrowing <"+e+">, although the MBean is succesfully " +
"unregistered");
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postDeregister method: "+
"rethrowing <"+e+
">, although the MBean is sucessfully unregistered");
} catch (Error er) {
MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
"]: " + "Error thrown by postDeregister: " +
"rethrowing <"+er+">, although the MBean is succesfully " +
"unregistered");
throw new RuntimeErrorException(er,
"Error thrown in postDeregister method: "+
"rethrowing <"+er+
">, although the MBean is sucessfully unregistered");
}
}
示例7: publishServerAsAService
import javax.management.MBeanRegistration; //導入依賴的package包/類
private ServiceRegistration publishServerAsAService(StandardService server) {
Properties props = new Properties();
// put some extra properties to easily identify the service
props.put(Constants.SERVICE_VENDOR, "Spring Dynamic Modules");
props.put(Constants.SERVICE_DESCRIPTION, ServerInfo.getServerInfo());
props.put(Constants.BUNDLE_VERSION, ServerInfo.getServerNumber());
props.put(Constants.BUNDLE_NAME, bundleContext.getBundle().getSymbolicName());
// spring-dm specific property
props.put("org.springframework.osgi.bean.name", "tomcat-server");
// publish just the interfaces and the major classes (server/handlerWrapper)
String[] classes = new String[] { StandardService.class.getName(), Service.class.getName(),
MBeanRegistration.class.getName(), Lifecycle.class.getName() };
return bundleContext.registerService(classes, server, props);
}