Search in sources :

Example 6 with JMXRequest

use of io.fabric8.api.commands.JMXRequest in project fabric8 by jboss-fuse.

the class JMXCommandActionSupport method doExecute.

@Override
protected Object doExecute() throws Exception {
    Collection<String> names = new LinkedList<>();
    if (allContainers) {
        if (containers != null && containers.size() > 0) {
            System.out.println("Container names are ignored when using \"--all\" option.");
        }
        Container[] all = CommandUtils.sortContainers(fabricService.getContainers());
        for (Container c : all) {
            names.add(c.getId());
        }
    } else {
        names.addAll(ContainerGlobSupport.expandGlobNames(fabricService, containers));
    }
    List<String> validContainerNames = new LinkedList<>();
    for (String name : names) {
        try {
            validateContainerName(name);
        } catch (IllegalArgumentException e) {
            System.err.println("Skipping illegal container name \"" + name + "\"");
            continue;
        }
        validContainerNames.add(name);
    }
    beforeEachContainer(validContainerNames);
    for (String name : validContainerNames) {
        // for each container we have to pass JMXRequest
        String path = ZkPath.COMMANDS_REQUESTS_QUEUE.getPath(name);
        performContainerAction(path, name);
    }
    afterEachContainer(validContainerNames);
    cleanResponses();
    return null;
}
Also used : Container(io.fabric8.api.Container) LinkedList(java.util.LinkedList)

Aggregations

JMXRequest (io.fabric8.api.commands.JMXRequest)5 GitVersion (io.fabric8.api.commands.GitVersion)2 GitVersions (io.fabric8.api.commands.GitVersions)2 JMXResult (io.fabric8.api.commands.JMXResult)2 Container (io.fabric8.api.Container)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Test (org.junit.Test)1