Java Code Examples for javax.management.ObjectName#apply()
The following examples show how to use
javax.management.ObjectName#apply() .
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: OldMBeanServerTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 2
Source File: OldMBeanServerTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 3
Source File: ApplyWildcardTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 4
Source File: ApplyWildcardTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 5
Source File: ApplyWildcardTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int runPositiveTests() { int error = 0; for (int i = 0; i < positiveTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(positiveTests[i][0]); ObjectName on2 = ObjectName.getInstance(positiveTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == false) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 6
Source File: ApplyWildcardTest.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 7
Source File: ApplyWildcardTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 8
Source File: ApplyWildcardTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 9
Source File: OldMBeanServerTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 10
Source File: ApplyWildcardTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static int runPositiveTests() { int error = 0; for (int i = 0; i < positiveTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(positiveTests[i][0]); ObjectName on2 = ObjectName.getInstance(positiveTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == false) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 11
Source File: OldMBeanServerTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 12
Source File: ApplyWildcardTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static int runNegativeTests() { int error = 0; for (int i = 0; i < negativeTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(negativeTests[i][0]); ObjectName on2 = ObjectName.getInstance(negativeTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == true) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 13
Source File: OldMBeanServerTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 14
Source File: ApplyWildcardTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static int runPositiveTests() { int error = 0; for (int i = 0; i < positiveTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(positiveTests[i][0]); ObjectName on2 = ObjectName.getInstance(positiveTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == false) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 15
Source File: OldMBeanServerTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 16
Source File: ApplyWildcardTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static int runPositiveTests() { int error = 0; for (int i = 0; i < positiveTests.length; i++) { System.out.println("----------------------------------------------"); try { ObjectName on1 = ObjectName.getInstance(positiveTests[i][0]); ObjectName on2 = ObjectName.getInstance(positiveTests[i][1]); System.out.println("\"" + on1 + "\".apply(\"" + on2 + "\")"); boolean result = on1.apply(on2); System.out.println("Result = " + result); if (result == false) { error++; System.out.println("Test failed!"); } else { System.out.println("Test passed!"); } } catch (Exception e) { error++; System.out.println("Got Unexpected Exception = " + e.toString()); System.out.println("Test failed!"); } System.out.println("----------------------------------------------"); } return error; }
Example 17
Source File: OldMBeanServerTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { Set<ObjectInstance> instances = newSet(); if (name == null) name = ObjectName.WILDCARD; if (query == null) query = trueQuery; MBeanServer oldMBS = QueryEval.getMBeanServer(); try { query.setMBeanServer(this); for (ObjectName n : mbeans.keySet()) { if (name.apply(n)) { try { if (query.apply(n)) instances.add(getObjectInstance(n)); } catch (Exception e) { // OK: Ignore this MBean in the result } } } } finally { query.setMBeanServer(oldMBS); } return instances; }
Example 18
Source File: NotificationBufferTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static NotificationBufferFilter makeFilter(final Integer id, final ObjectName pattern, final NotificationFilter filter) { return new NotificationBufferFilter() { public void apply(List<TargetedNotification> notifs, ObjectName source, Notification notif) { if (pattern.apply(source)) { if (filter == null || filter.isNotificationEnabled(notif)) notifs.add(new TargetedNotification(notif, id)); } } }; }
Example 19
Source File: DistributedSystemBridge.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public ObjectName[] listGatewaySenderObjectNames(String member) throws Exception { validateMember(member); DistributedMember distributedMember = BeanUtilFuncs .getDistributedMemberByNameOrId(member); List<ObjectName> listName = null; ObjectName pattern = new ObjectName( ManagementConstants.GATEWAY_SENDER_PATTERN); Set<ObjectName> mbeanSet = service.queryMBeanNames(distributedMember); if (mbeanSet != null && mbeanSet.size() > 0) { listName = new ArrayList<ObjectName>(); for (ObjectName name : mbeanSet) { if (pattern.apply(name)) { listName.add(name); } } } if (listName != null && listName.size() > 0) { ObjectName[] arry = new ObjectName[listName.size()]; return listName.toArray(arry); } return ManagementConstants.NO_DATA_OBJECTNAME; }
Example 20
Source File: NotificationBufferTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static NotificationBufferFilter makeFilter(final Integer id, final ObjectName pattern, final NotificationFilter filter) { return new NotificationBufferFilter() { public void apply(List<TargetedNotification> notifs, ObjectName source, Notification notif) { if (pattern.apply(source)) { if (filter == null || filter.isNotificationEnabled(notif)) notifs.add(new TargetedNotification(notif, id)); } } }; }