当前位置: 首页>>代码示例>>Java>>正文


Java ObjectName.equals方法代码示例

本文整理汇总了Java中javax.management.ObjectName.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectName.equals方法的具体用法?Java ObjectName.equals怎么用?Java ObjectName.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.ObjectName的用法示例。


在下文中一共展示了ObjectName.equals方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remove

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Same behavior as remove(Object o) in {@link java.util.List}.
 * Replace the loader list with a new one in which the old loader
 * has been removed.
 *
 * The ObjectName may be null, in which case the entry to
 * be removed must also have a null ObjectName and the ClassLoader
 * values must match.  If the ObjectName is not null, then
 * the first entry with a matching ObjectName is removed,
 * regardless of whether ClassLoader values match.  (In fact,
 * the ClassLoader parameter will usually be null in this case.)
 **/
private synchronized boolean remove(ObjectName name, ClassLoader cl) {
    final int size = loaders.length;
    for (int i = 0; i < size; i++) {
        LoaderEntry entry = loaders[i];
        boolean match =
            (name == null) ?
            cl == entry.loader :
            name.equals(entry.name);
        if (match) {
            LoaderEntry[] newloaders = new LoaderEntry[size - 1];
            System.arraycopy(loaders, 0, newloaders, 0, i);
            System.arraycopy(loaders, i + 1, newloaders, i,
                             size - 1 - i);
            loaders = newloaders;
            return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:ClassLoaderRepositorySupport.java

示例2: main

import javax.management.ObjectName; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:DelegateNameWildcardNameTest.java

示例3: checkNotifs

import javax.management.ObjectName; //导入方法依赖的package包/类
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:NotificationEmissionTest.java

示例4: checkNotifs

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:NotificationAccessControllerTest.java

示例5: removeValve

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Remove an existing Valve.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeValve(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    ContainerBase container = getParentContainerFromChild(oname);
    Valve[] valves = container.getPipeline().getValves();
    for (int i = 0; i < valves.length; i++) {
        ObjectName voname = ((ValveBase) valves[i]).getObjectName();
        if (voname.equals(oname)) {
            container.getPipeline().removeValve(valves[i]);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:MBeanFactory.java

示例6: removeValve

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Remove an existing Valve.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeValve(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    ContainerBase container = getParentContainerFromChild(oname);
    String sequence = oname.getKeyProperty("seq");
    Valve[] valves = (Valve[])container.getValves();
    for (int i = 0; i < valves.length; i++) {
        ObjectName voname = ((ValveBase) valves[i]).getObjectName();
        if (voname.equals(oname)) {
            container.removeValve(valves[i]);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:MBeanFactory.java

示例7: removeReference

import javax.management.ObjectName; //导入方法依赖的package包/类
synchronized boolean removeReference(ObjectName name, Object mxbean) {
    if (name.equals(mxbeanToObjectName.get(mxbean))) {
        mxbeanToObjectName.remove(mxbean);
        return true;
    } else
        return false;
    /* removeReference can be called when the above condition fails,
     * notably if you try to register the same MXBean twice.
     */
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:MXBeanLookup.java

示例8: addMemberToSystem

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Add a proxy to the map to be used by bridge.
 *
 * @param objectName object name of the proxy
 * @param proxy actual proxy instance
 */
public void addMemberToSystem(ObjectName objectName, MemberMXBean proxy,
    FederationComponent newState) {

  if (objectName.equals(thisMemberName)) {
    ObjectName distrObjectName = MBeanJMXAdapter.getDistributedSystemName();
    DistributedSystemMXBean systemMBean = new DistributedSystemMBean(this);
    service.registerInternalMBean(systemMBean, distrObjectName);
    this.systemLevelNotifEmitter = (DistributedSystemMBean) service.getDistributedSystemMXBean();
    this.distListener = new DistributedSystemNotifListener();
  }

  if (mapOfMembers != null) {
    mapOfMembers.put(objectName, proxy);
    memberSetSize = mapOfMembers.values().size();

  }
  updateMember(objectName, newState, null);

  try {
    mbeanServer.addNotificationListener(objectName, distListener, null, null);
  } catch (InstanceNotFoundException e) {

    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage());
    }

    logger.info(LocalizedMessage.create(ManagementStrings.INSTANCE_NOT_FOUND, objectName));

  }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:38,代码来源:DistributedSystemBridge.java

示例9: removeValve

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Remove an existing Valve.
 *
 * @param name
 *            MBean Name of the component to remove
 *
 * @exception Exception
 *                if a component cannot be removed
 */
public void removeValve(String name) throws Exception {

	// Acquire a reference to the component to be removed
	ObjectName oname = new ObjectName(name);
	ContainerBase container = getParentContainerFromChild(oname);
	Valve[] valves = container.getPipeline().getValves();
	for (int i = 0; i < valves.length; i++) {
		ObjectName voname = ((ValveBase) valves[i]).getObjectName();
		if (voname.equals(oname)) {
			container.getPipeline().removeValve(valves[i]);
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:23,代码来源:MBeanFactory.java

示例10: main

import javax.management.ObjectName; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    for (Class<?> c : new Class<?>[] {
            Spume.class, Thing.class, XSpume.class, XThing.class
         }) {
        for (ObjectName n : new ObjectName[] {null, new ObjectName("a:b=c")}) {
            System.out.println("Class " + c.getName() + " with name " + n +
                    "...");
            ObjectName realName = new ObjectName("a:type=" + c.getName());
            Constructor<?> constr = c.getConstructor(ObjectName.class);
            Object mbean = constr.newInstance(realName);
            ObjectInstance oi;
            String what =
                "Registering MBean of type " + c.getName() + " under name " +
                "<" + n + ">: ";
            try {
                oi = mbs.registerMBean(mbean, n);
            } catch (Exception e) {
                e.printStackTrace();
                fail(what + " got " + e);
                continue;
            }
            ObjectName registeredName = oi.getObjectName();
            if (!registeredName.equals(realName))
                fail(what + " registered as " + registeredName);
            if (!mbs.isRegistered(realName)) {
                fail(what + " not registered as expected");
            }
            mbs.unregisterMBean(registeredName);
        }
    }
    System.err.flush();
    if (failures == 0)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: " + failure);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:PreRegisterNameTest.java

示例11: doBasicMXBeanTest

import javax.management.ObjectName; //导入方法依赖的package包/类
private final int doBasicMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- doBasicMXBeanTest") ;

    try {
        ObjectName objName =
                new ObjectName("sqe:type=BasicMXBean") ;
        mbsc.createMBean(BASIC_MXBEAN_CLASS_NAME, objName);
        MBeanInfo mbInfo = mbsc.getMBeanInfo(objName);
        printMBeanInfo(mbInfo);
        System.out.println("---- OK\n") ;
        System.out.println("getMBeanInfo\t\t"
                + mbInfo);
        System.out.println("---- OK\n") ;

        System.out.println("Check mxbean field in the MBeanInfo");
        String mxbeanField =
                (String)mbInfo.getDescriptor().getFieldValue(JMX.MXBEAN_FIELD);

        if ( mxbeanField == null || ! mxbeanField.equals("true")) {
            System.out.println("---- ERROR : Improper mxbean field value "
                    + mxbeanField);
            errorCount++;
        }
        System.out.println("---- OK\n") ;

        System.out.println("Set attribute ObjectNameAtt");
        Attribute att = new Attribute("ObjectNameAtt", objName);
        mbsc.setAttribute(objName, att);
        ObjectName value =
                (ObjectName)mbsc.getAttribute(objName, "ObjectNameAtt");

        if ( ! value.equals(objName) ) {
            errorCount++;
            System.out.println("---- ERROR : setAttribute failed, got "
                    + value
                    + " while expecting "
                    + objName);
        }
        System.out.println("---- OK\n") ;

        System.out.println("Call operation doNothing");
        mbsc.invoke(objName,  "doNothing", null, null);
        System.out.println("---- OK\n") ;

        System.out.println("Call operation getWeather");
        Object weather = mbsc.invoke(objName,
                "getWeather",
                new Object[]{Boolean.TRUE},
                new String[]{"boolean"});
        System.out.println("Weather is " + weather);
        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:61,代码来源:MXBeanInteropTest2.java

示例12: instantiate

import javax.management.ObjectName; //导入方法依赖的package包/类
public Object instantiate(
        String className, ObjectName loaderName,
        Object[] params, String[] signature)
throws ReflectionException, MBeanException, InstanceNotFoundException {

    if (params == null)
        params = new Object[0];
    if (signature == null)
        signature = new String[0];

    ClassLoader loader;
    if (loaderName == null)
        loader = this.getClass().getClassLoader();
    else if (loaderName.equals(clrName))
        loader = clr;
    else
        loader = (ClassLoader) getMBean(loaderName);

    Class<?> c;
    try {
        c = Class.forName(className, false, loader);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e);
    }

    Constructor[] constrs = c.getConstructors();
    Constructor found = null;
    findconstr:
    for (Constructor constr : constrs) {
        Class<?>[] cTypes = constr.getParameterTypes();
        if (cTypes.length == signature.length) {
            for (int i = 0; i < cTypes.length; i++) {
                if (!cTypes[i].getName().equals(signature[i]))
                    continue findconstr;
            }
            found = constr;
            break findconstr;
        }
    }
    if (found == null) {
        Exception x = new NoSuchMethodException(
                className + Arrays.toString(signature));
        throw new ReflectionException(x);
    }
    return invokeSomething(found, null, params);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:47,代码来源:OldMBeanServerTest.java


注:本文中的javax.management.ObjectName.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。