/** * Helper method to query {@link ObjectName}s from an {@link MBeanServer} * based on {@link Predicate} * * @param server * @param predicate * @return */ public static Set<ObjectName> queryNames(MBeanServer server, final Predicate<ObjectName> predicate) { @SuppressWarnings("serial") Set<ObjectName> registered = server.queryNames(null, new QueryExp() { @Override public void setMBeanServer(MBeanServer s) { } @Override public boolean apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException { return predicate.test(name); } }); return registered; }
/** * Sends a message * @param msg Message that shall be send * @throws InvalidApplicationException If the passed argument is null * @throws IOException In case of an error during writing the output stream */ public abstract void send(@NotNull String msg) throws InvalidApplicationException;