@Test public void testJmxOperationPolledForSensor() throws Exception { final int opReturnVal = 123; final AtomicInteger invocationCount = new AtomicInteger(); MBeanOperationInfo opInfo = new MBeanOperationInfo(opName, "my descr", new MBeanParameterInfo[0], Integer.class.getName(), MBeanOperationInfo.ACTION); GeneralisedDynamicMBean mbean = jmxService.registerMBean( Collections.emptyMap(), ImmutableMap.of(opInfo, new Function<Object[], Integer>() { public Integer apply(Object[] args) { invocationCount.incrementAndGet(); return opReturnVal; }}), objectName); feed = JmxFeed.builder() .entity(entity) .pollOperation(new JmxOperationPollConfig<Integer>(intAttribute) .objectName(objectName) .operationName(opName)) .build(); Asserts.succeedsEventually(ImmutableMap.of("timeout", TIMEOUT_MS), new Runnable() { public void run() { assertTrue(invocationCount.get() > 0, "invocationCount="+invocationCount); assertEquals(entity.getAttribute(intAttribute), (Integer)opReturnVal); }}); }
public static Builder builder() { return new Builder(); }
JmxFeed extends AbstractFeed { public static Builder builder() { return new Builder(); } }
JmxFeed extends AbstractFeed { public static Builder builder() { return new Builder(); } JmxFeed(); protected  JmxFeed(Builder builder); }
JmxFeed extends AbstractFeed { public static Builder builder() { return new Builder(); } JmxFeed(); protected  JmxFeed(Builder builder); static Builder builder(); @Override void setEntity(EntityLocal entity); String getJmxUri(); @Override String toString(); }
JmxFeed extends AbstractFeed { public static Builder builder() { return new Builder(); } JmxFeed(); protected  JmxFeed(Builder builder); static Builder builder(); @Override void setEntity(EntityLocal entity); String getJmxUri(); @Override String toString(); static final Logger log; static final long JMX_CONNECTION_TIMEOUT_MS; static final ConfigKey<JmxHelper> HELPER; static final ConfigKey<Boolean> OWN_HELPER; static final ConfigKey<String> JMX_URI; static final ConfigKey<Long> JMX_CONNECTION_TIMEOUT; @SuppressWarnings("serial")
    static final ConfigKey<SetMultimap<String, JmxAttributePollConfig<?>>> ATTRIBUTE_POLLS; @SuppressWarnings("serial")
    static final ConfigKey<SetMultimap<List<?>, JmxOperationPollConfig<?>>> OPERATION_POLLS; @SuppressWarnings("serial")
    static final ConfigKey<SetMultimap<NotificationFilter, JmxNotificationSubscriptionConfig<?>>> NOTIFICATION_SUBSCRIPTIONS; }