com.sun.jmx.mbeanserver.StandardMBeanSupport Java Examples

The following examples show how to use com.sun.jmx.mbeanserver.StandardMBeanSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardMBean.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #2
Source File: StandardMBean.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #3
Source File: StandardMBean.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #4
Source File: StandardMBean.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #5
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #6
Source File: StandardMBean.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #7
Source File: StandardMBean.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #8
Source File: StandardMBean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #9
Source File: StandardMBean.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #10
Source File: StandardMBean.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #11
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #12
Source File: StandardMBean.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #13
Source File: StandardMBean.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #14
Source File: StandardMBean.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #15
Source File: StandardMBean.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #16
Source File: StandardMBean.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
Example #17
Source File: StandardMBean.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #18
Source File: StandardMBean.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #19
Source File: StandardMBean.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #20
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #21
Source File: StandardMBean.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #22
Source File: StandardMBean.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #23
Source File: StandardMBean.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #24
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #25
Source File: StandardMBean.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #26
Source File: StandardMBean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #27
Source File: StandardMBean.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #28
Source File: StandardMBean.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #29
Source File: StandardMBean.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
Example #30
Source File: StandardMBean.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}