javax.management.timer.TimerMBean Java Examples
The following examples show how to use
javax.management.timer.TimerMBean.
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: JMXControlServiceTest.java From quarks with Apache License 2.0 | 5 votes |
@Test(expected=RuntimeException.class) public void testDoubleRegister() throws Exception { ControlService cs = new JMXControlService(DOMAIN, new Hashtable<>()); String type = "timer"; String id = "a"; String alias = "ControlA"; String controlId = cs.registerControl(type, id, alias, TimerMBean.class, new Timer()); try { cs.registerControl(type, id, alias, TimerMBean.class, new Timer()); } finally { cs.unregister(controlId); } }
Example #2
Source File: JMXControlServiceTest.java From quarks with Apache License 2.0 | 5 votes |
@Test(expected=RuntimeException.class) public void testDoubleunregister() throws Exception { ControlService cs = new JMXControlService(DOMAIN, new Hashtable<>()); String type = "timer"; String id = "a"; String alias = "ControlA"; String controlId = cs.registerControl(type, id, alias, TimerMBean.class, new Timer()); cs.unregister(controlId); cs.unregister(controlId); }
Example #3
Source File: JMXControlServiceTest.java From quarks with Apache License 2.0 | 3 votes |
@Test public void testControlObject() throws Exception { ControlService cs = new JMXControlService(DOMAIN, new Hashtable<>()); String type = "timer"; String id = "a"; String alias = "ControlA"; String controlId = cs.registerControl(type, id, alias, TimerMBean.class, new Timer()); assertNotNull(controlId); ObjectName on = ObjectName.getInstance(controlId); assertEquals(DOMAIN, on.getDomain()); assertEquals(type, ObjectName.unquote(on.getKeyProperty("type"))); assertEquals(id, ObjectName.unquote(on.getKeyProperty("id"))); assertEquals(alias, ObjectName.unquote(on.getKeyProperty("alias"))); assertEquals(TimerMBean.class.getName(), ObjectName.unquote(on.getKeyProperty("interface"))); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); assertTrue(mbs.isRegistered(on)); cs.unregister(controlId); assertFalse(mbs.isRegistered(on)); }
Example #4
Source File: JMXControlServiceTest.java From quarks with Apache License 2.0 | 3 votes |
@Test public void testAdditionalKeys() throws Exception { Hashtable<String,String> addKeys = new Hashtable<>(); addKeys.put("job", "jobid"); addKeys.put("device", ObjectName.quote("pi")); ControlService cs = new JMXControlService(DOMAIN, addKeys); String type = "timer"; String id = "a"; String alias = "ControlA"; String controlId = cs.registerControl(type, id, alias, TimerMBean.class, new Timer()); assertNotNull(controlId); ObjectName on = ObjectName.getInstance(controlId); assertEquals(DOMAIN, on.getDomain()); assertEquals(type, ObjectName.unquote(on.getKeyProperty("type"))); assertEquals(id, ObjectName.unquote(on.getKeyProperty("id"))); assertEquals(alias, ObjectName.unquote(on.getKeyProperty("alias"))); assertEquals(TimerMBean.class.getName(), ObjectName.unquote(on.getKeyProperty("interface"))); assertEquals("jobid", on.getKeyProperty("job")); assertEquals("pi", ObjectName.unquote(on.getKeyProperty("device"))); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); assertTrue(mbs.isRegistered(on)); cs.unregister(controlId); assertFalse(mbs.isRegistered(on)); }