Java Code Examples for javax.management.ObjectName#isPattern()

The following examples show how to use javax.management.ObjectName#isPattern() . 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: Repository.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieves the named object contained in repository
 * from the given objectname.
 */
private NamedObject retrieveNamedObject(ObjectName name) {

    // No patterns inside reposit
    if (name.isPattern()) return null;

    // Extract the domain name.
    String dom = name.getDomain().intern();

    // Default domain case
    if (dom.length() == 0) {
        dom = domain;
    }

    Map<String,NamedObject> moiTb = domainTb.get(dom);
    if (moiTb == null) {
        return null; // No domain containing registered object names
    }

    return moiTb.get(name.getCanonicalKeyPropertyListString());
}
 
Example 2
Source File: Repository.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieves the named object contained in repository
 * from the given objectname.
 */
private NamedObject retrieveNamedObject(ObjectName name) {

    // No patterns inside reposit
    if (name.isPattern()) return null;

    // Extract the domain name.
    String dom = name.getDomain().intern();

    // Default domain case
    if (dom.length() == 0) {
        dom = domain;
    }

    Map<String,NamedObject> moiTb = domainTb.get(dom);
    if (moiTb == null) {
        return null; // No domain containing registered object names
    }

    return moiTb.get(name.getCanonicalKeyPropertyListString());
}
 
Example 3
Source File: Repository.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieves the named object contained in repository
 * from the given objectname.
 */
private NamedObject retrieveNamedObject(ObjectName name) {

    // No patterns inside reposit
    if (name.isPattern()) return null;

    // Extract the domain name.
    String dom = name.getDomain().intern();

    // Default domain case
    if (dom.length() == 0) {
        dom = domain;
    }

    Map<String,NamedObject> moiTb = domainTb.get(dom);
    if (moiTb == null) {
        return null; // No domain containing registered object names
    }

    return moiTb.get(name.getCanonicalKeyPropertyListString());
}
 
Example 4
Source File: Repository.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieves the named object contained in repository
 * from the given objectname.
 */
private NamedObject retrieveNamedObject(ObjectName name) {

    // No patterns inside reposit
    if (name.isPattern()) return null;

    // Extract the domain name.
    String dom = name.getDomain().intern();

    // Default domain case
    if (dom.length() == 0) {
        dom = domain;
    }

    Map<String,NamedObject> moiTb = domainTb.get(dom);
    if (moiTb == null) {
        return null; // No domain containing registered object names
    }

    return moiTb.get(name.getCanonicalKeyPropertyListString());
}
 
Example 5
Source File: LiveJvmServiceImpl.java    From glowroot with Apache License 2.0 5 votes vote down vote up
private Set<ObjectName> getObjectNames(String mbeanObjectName) throws Exception {
    ObjectName objectName = ObjectName.getInstance(mbeanObjectName);
    List<MBeanServer> mbeanServers = lazyPlatformMBeanServer.findAllMBeanServers();
    if (objectName.isPattern()) {
        return lazyPlatformMBeanServer.queryNames(objectName, null, mbeanServers);
    } else {
        try {
            lazyPlatformMBeanServer.getMBeanInfo(objectName, mbeanServers);
        } catch (InstanceNotFoundException e) {
            return ImmutableSet.of();
        }
        return ImmutableSet.of(objectName);
    }
}
 
Example 6
Source File: ServerNotifForwarder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 7
Source File: ServerNotifForwarder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 8
Source File: ServerNotifForwarder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 9
Source File: ServerNotifForwarder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 10
Source File: ServerNotifForwarder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 11
Source File: ServerNotifForwarder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 12
Source File: ServerNotifForwarder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void removeNotificationListener(ObjectName name, Integer listenerID)
throws
    InstanceNotFoundException,
    ListenerNotFoundException,
    IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
            "Remove the listener " + listenerID + " from " + name);
    }

    checkState();

    if (name != null && !name.isPattern()) {
        if (!mbeanServer.isRegistered(name)) {
            throw new InstanceNotFoundException("The MBean " + name +
                " is not registered.");
        }
    }

    synchronized (listenerMap) {
        // Tread carefully because if set.size() == 1 it may be a
        // Collections.singleton, which is unmodifiable.
        Set<IdAndFilter> set = listenerMap.get(name);
        IdAndFilter idaf = new IdAndFilter(listenerID, null);
        if (set == null || !set.contains(idaf))
            throw new ListenerNotFoundException("Listener not found");
        if (set.size() == 1)
            listenerMap.remove(name);
        else
            set.remove(idaf);
    }
}
 
Example 13
Source File: Repository.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
                "addMBean", "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
Example 14
Source File: Repository.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
                "addMBean", "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
Example 15
Source File: Repository.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
                "addMBean", "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
Example 16
Source File: Repository.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
                "addMBean", "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
Example 17
Source File: ObjectInstance.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Allows an object instance to be created given an object name and
 * the full class name, including the package name.
 *
 * @param objectName  The object name.
 * @param className  The full class name, including the package
 * name, of the object instance.  If the MBean is a Dynamic MBean
 * the class name corresponds to its {@link
 * DynamicMBean#getMBeanInfo()
 * getMBeanInfo()}<code>.getClassName()</code>.
 * If the MBean is a Dynamic MBean the class name should be retrieved
 * from the <CODE>MBeanInfo</CODE> it provides.
 *
 */
public ObjectInstance(ObjectName objectName, String className) {
    if (objectName.isPattern()) {
        final IllegalArgumentException iae =
            new IllegalArgumentException("Invalid name->"+
                                         objectName.toString());
        throw new RuntimeOperationsException(iae);
    }
    this.name= objectName;
    this.className= className;
}
 
Example 18
Source File: ObjectInstance.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Allows an object instance to be created given an object name and
 * the full class name, including the package name.
 *
 * @param objectName  The object name.
 * @param className  The full class name, including the package
 * name, of the object instance.  If the MBean is a Dynamic MBean
 * the class name corresponds to its {@link
 * DynamicMBean#getMBeanInfo()
 * getMBeanInfo()}<code>.getClassName()</code>.
 * If the MBean is a Dynamic MBean the class name should be retrieved
 * from the <CODE>MBeanInfo</CODE> it provides.
 *
 */
public ObjectInstance(ObjectName objectName, String className) {
    if (objectName.isPattern()) {
        final IllegalArgumentException iae =
            new IllegalArgumentException("Invalid name->"+
                                         objectName.toString());
        throw new RuntimeOperationsException(iae);
    }
    this.name= objectName;
    this.className= className;
}
 
Example 19
Source File: ObjectInstance.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Allows an object instance to be created given an object name and
 * the full class name, including the package name.
 *
 * @param objectName  The object name.
 * @param className  The full class name, including the package
 * name, of the object instance.  If the MBean is a Dynamic MBean
 * the class name corresponds to its {@link
 * DynamicMBean#getMBeanInfo()
 * getMBeanInfo()}<code>.getClassName()</code>.
 * If the MBean is a Dynamic MBean the class name should be retrieved
 * from the <CODE>MBeanInfo</CODE> it provides.
 *
 */
public ObjectInstance(ObjectName objectName, String className) {
    if (objectName.isPattern()) {
        final IllegalArgumentException iae =
            new IllegalArgumentException("Invalid name->"+
                                         objectName.toString());
        throw new RuntimeOperationsException(iae);
    }
    this.name= objectName;
    this.className= className;
}
 
Example 20
Source File: ObjectInstance.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Allows an object instance to be created given an object name and
 * the full class name, including the package name.
 *
 * @param objectName  The object name.
 * @param className  The full class name, including the package
 * name, of the object instance.  If the MBean is a Dynamic MBean
 * the class name corresponds to its {@link
 * DynamicMBean#getMBeanInfo()
 * getMBeanInfo()}<code>.getClassName()</code>.
 * If the MBean is a Dynamic MBean the class name should be retrieved
 * from the <CODE>MBeanInfo</CODE> it provides.
 *
 */
public ObjectInstance(ObjectName objectName, String className) {
    if (objectName.isPattern()) {
        final IllegalArgumentException iae =
            new IllegalArgumentException("Invalid name->"+
                                         objectName.toString());
        throw new RuntimeOperationsException(iae);
    }
    this.name= objectName;
    this.className= className;
}