ReadHandler extends JsonRequestHandler<JmxReadRequest> { @Override public boolean handleAllServersAtOnce(JmxReadRequest pRequest) { return pRequest.getObjectName().isPattern() || pRequest.isMultiAttributeMode() || !pRequest.hasAttribute(); } ReadHandler(Restrictor pRestrictor); @Override /** {@inheritDoc} */ RequestType getType(); @Override boolean handleAllServersAtOnce(JmxReadRequest pRequest); @Override Object doHandleRequest(MBeanServerConnection pServer, JmxReadRequest pRequest); @Override /** {@inheritDoc} */ Object doHandleRequest(MBeanServerExecutor pServerManager, JmxReadRequest pRequest);  }
@Test public void handleAllServersAtOnceTest() throws MalformedObjectNameException { JmxReadRequest request = new JmxRequestBuilder(READ, testBeanName). attribute("attr"). build(); assertFalse(handler.handleAllServersAtOnce(request)); request = new JmxRequestBuilder(READ, testBeanName). attributes(Arrays.asList("attr1","attr2")). build(); assertTrue(handler.handleAllServersAtOnce(request)); request = new JmxRequestBuilder(READ, testBeanName). attributes((List) null). build(); assertTrue(handler.handleAllServersAtOnce(request)); request = new JmxRequestBuilder(READ, "java.lang:*"). attribute("attr"). build(); assertTrue(handler.handleAllServersAtOnce(request)); }