📄 jmxmbeanserver.java
字号:
* automatically provide its own name by implementing the * {@link javax.management.MBeanRegistration MBeanRegistration} interface. * The call returns an <CODE>ObjectInstance</CODE> object representing * the newly created MBean. * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. * @param loaderName The object name of the class loader to be used. * * @return An <CODE>ObjectInstance</CODE>, containing the * <CODE>ObjectName</CODE> and the Java class name * of the newly instantiated MBean. * * @exception ReflectionException Wraps an * <CODE>{@link java.lang.ClassNotFoundException}</CODE> or an * <CODE>{@link java.lang.Exception}</CODE> that occurred when trying * to invoke the MBean's constructor. * @exception InstanceAlreadyExistsException The MBean is already * under the control of the MBean server. * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> * (<CODE>MBeanRegistration</CODE> interface) method of the MBean * has thrown an exception. The MBean will not be registered. * @exception MBeanException The constructor of the MBean has thrown * an exception * @exception NotCompliantMBeanException This class is not a JMX * compliant MBean. * @exception InstanceNotFoundException The specified class loader * is not registered in the MBean server. * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The * className passed in parameter is null, the <CODE>ObjectName</CODE> * passed in parameter contains a pattern or no * <CODE>ObjectName</CODE> is specified for the MBean. */ public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException { return mbsInterceptor.createMBean(className, cloneObjectName(name), loaderName, (Object[]) null, (String[]) null); } /** * Instantiates and registers an MBean in the MBean server. * The MBean server will use its * {@link javax.management.loading.ClassLoaderRepository Default Loader Repository} * to load the class of the MBean. * An object name is associated to the MBean. * If the object name given is null, the MBean can automatically * provide its own name by implementing the * {@link javax.management.MBeanRegistration MBeanRegistration} interface. * The call returns an <CODE>ObjectInstance</CODE> object representing * the newly created MBean. * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. * @param params An array containing the parameters of the constructor * to be invoked. * @param signature An array containing the signature of the * constructor to be invoked. * * @return An <CODE>ObjectInstance</CODE>, containing the * <CODE>ObjectName</CODE> and the Java class name * of the newly instantiated MBean. * * @exception ReflectionException Wraps a * <CODE>{@link java.lang.ClassNotFoundException}</CODE> or an * <CODE>{@link java.lang.Exception}</CODE> that occurred * when trying to invoke the MBean's constructor. * @exception InstanceAlreadyExistsException The MBean is already * under the control of the MBean server. * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> * (<CODE>MBeanRegistration</CODE> interface) method of the MBean * has thrown an exception. The MBean will not be registered. * @exception MBeanException The constructor of the MBean has * thrown an exception. * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The * className passed in parameter is null, the <CODE>ObjectName</CODE> * passed in parameter contains a pattern or no * <CODE>ObjectName</CODE> is specified for the MBean. * */ public ObjectInstance createMBean(String className, ObjectName name, Object params[], String signature[]) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException { return mbsInterceptor.createMBean(className, cloneObjectName(name), params, signature); } /** * Instantiates and registers an MBean in the MBean server. * The class loader to be used is identified by its object name. * An object name is associated to the MBean. If the object name * of the loader is not specified, the ClassLoader that loaded the * MBean server will be used. * If the MBean object name given is null, the MBean can automatically * provide its own name by implementing the * {@link javax.management.MBeanRegistration MBeanRegistration} interface. * The call returns an <CODE>ObjectInstance</CODE> object representing * the newly created MBean. * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. * @param params An array containing the parameters of the constructor * to be invoked. * @param signature An array containing the signature of the * constructor to be invoked. * @param loaderName The object name of the class loader to be used. * * @return An <CODE>ObjectInstance</CODE>, containing the * <CODE>ObjectName</CODE> and the Java class name of the newly * instantiated MBean. * * @exception ReflectionException Wraps a * <CODE>{@link java.lang.ClassNotFoundException}</CODE> or an * <CODE>{@link java.lang.Exception}</CODE> * that occurred when trying to invoke the MBean's constructor. * @exception InstanceAlreadyExistsException The MBean is already * under the control of the MBean server. * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> * (<CODE>MBeanRegistration</CODE> interface) method of the MBean * has thrown an exception. The MBean will not be registered. * @exception MBeanException The constructor of the MBean has * thrown an exception * @exception InstanceNotFoundException The specified class loader is * not registered in the MBean server. * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The * className passed in parameter is null, the <CODE>ObjectName</CODE> * passed in parameter contains a pattern or no * <CODE>ObjectName</CODE> is specified for the MBean. * */ public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object params[], String signature[]) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException { return mbsInterceptor.createMBean(className, cloneObjectName(name), loaderName, params, signature); } /** * Registers a pre-existing object as an MBean with the MBean server. * If the object name given is null, the MBean may automatically * provide its own name by implementing the * {@link javax.management.MBeanRegistration MBeanRegistration} interface. * The call returns an <CODE>ObjectInstance</CODE> object representing * the registered MBean. * * @param object The MBean to be registered as an MBean. * @param name The object name of the MBean. May be null. * * @return The <CODE>ObjectInstance</CODE> for the MBean that has been * registered. * * @exception InstanceAlreadyExistsException The MBean is already * under the control of the MBean server. * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> * (<CODE>MBeanRegistration</CODE> interface) method of the MBean * has thrown an exception. The MBean will not be registered. * @exception NotCompliantMBeanException This object is not a JMX * compliant MBean * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The * object passed in parameter is null or no object name is specified. * */ public ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { return mbsInterceptor.registerMBean(object, cloneObjectName(name)); } /** * De-registers an MBean from the MBean server. The MBean is identified by * its object name. Once the method has been invoked, the MBean may * no longer be accessed by its object name. * * @param name The object name of the MBean to be de-registered. * * @exception InstanceNotFoundException The MBean specified is not * registered in the MBean server. * @exception MBeanRegistrationException The <code>preDeregister()</code> * (<CODE>MBeanRegistration</CODE> interface) method of the MBean * has thrown an exception. * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The * object name in parameter is null or the MBean you are when * trying to de-register is the * {@link javax.management.MBeanServerDelegate MBeanServerDelegate} * MBean. **/ public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException { mbsInterceptor.unregisterMBean(cloneObjectName(name)); } /** * Gets the <CODE>ObjectInstance</CODE> for a given MBean registered * with the MBean server. * * @param name The object name of the MBean. * * @return The <CODE>ObjectInstance</CODE> associated to the MBean * specified by <VAR>name</VAR>. * * @exception InstanceNotFoundException The MBean specified is not * registered in the MBean server. */ public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { return mbsInterceptor.getObjectInstance(cloneObjectName(name)); } /** * Gets MBeans controlled by the MBean server. This method allows any * of the following to be obtained: All MBeans, a set of MBeans specified * by pattern matching on the <CODE>ObjectName</CODE> and/or a Query * expression, a specific MBean. When the object name is null or no * domain and key properties are specified, all objects are to be * selected (and filtered if a query is specified). It returns the * set of <CODE>ObjectInstance</CODE> objects (containing the * <CODE>ObjectName</CODE> and the Java Class name) for * the selected MBeans. * * @param name The object name pattern identifying the MBeans to * be retrieved. If null or or no domain and key properties * are specified, all the MBeans registered will be retrieved. * @param query The query expression to be applied for selecting * MBeans. If null no query expression will be applied for * selecting MBeans. * * @return A set containing the <CODE>ObjectInstance</CODE> objects * for the selected MBeans. * If no MBean satisfies the query an empty list is returned. * */ public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return mbsInterceptor.queryMBeans(cloneObjectName(name), query); } /** * Gets the names of MBeans controlled by the MBean server. This method * enables any of the following to be obtained: The names of all MBeans, * the names of a set of MBeans specified by pattern matching on the * <CODE>ObjectName</CODE> and/or a Query expression, a specific * MBean name (equivalent to testing whether an MBean is registered). * When the object name is null or or no domain and key properties are * specified, all objects are selected (and filtered if a query is * specified). It returns the set of ObjectNames for the MBeans * selected. * * @param name The object name pattern identifying the MBeans to be * retrieved. If null or no domain and key properties are * specified, all the MBeans registered will be retrieved. * @param query The query expression to be applied for selecting * MBeans. If null no query expression will be applied for * selecting MBeans. * * @return A set containing the ObjectNames for the MBeans selected. * If no MBean satisfies the query, an empty list is returned. * */ public Set<ObjectName> queryNames(ObjectName name, QueryExp query) { return mbsInterceptor.queryNames(cloneObjectName(name), query); } /** * Checks whether an MBean, identified by its object name, is already * registered with the MBean server. * * @param name The object name of the MBean to be checked. * * @return True if the MBean is already registered in the MBean server, * false otherwise. * * @exception RuntimeOperationsException Wraps an * <CODE>{@link java.lang.IllegalArgumentException}</CODE>: The object * name in parameter is null. * */ public boolean isRegistered(ObjectName name) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -