Package org.apache.karaf.shell.support

Examples of org.apache.karaf.shell.support.MultiException


    static final String DEBUG_OPTS = " -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005";
    static final String DEFAULT_OPTS = "-server -Xmx512M -Dcom.sun.management.jmxremote";

    protected Object doExecute() throws Exception {
        MultiException exception = new MultiException("Error starting instance(s)");
        List<Instance> toWaitFor = new ArrayList<>();
        for (Instance instance : getMatchingInstances(instances)) {
            try {
                String opts = javaOpts;
                if (opts == null) {
                    opts = instance.getJavaOpts();
                }
                if (opts == null) {
                    opts = DEFAULT_OPTS;
                }
                if (debug) {
                    opts += DEBUG_OPTS;
                }
                instance.restart(opts);
            } catch (Exception e) {
                exception.addException(e);
            }
        }
        exception.throwIfExceptions();
        while (true) {
            boolean allStarted = true;
            for (Instance child : toWaitFor) {
                allStarted &= Instance.STARTED.equals(child.getState());
            }
View Full Code Here


    @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = true)
    @Completion(StartedInstanceCompleter.class)
    private List<String> instances = null;

    protected Object doExecute() throws Exception {
        final MultiException exception = new MultiException("Error stopping instance(s)");
        for (Instance instance : getMatchingInstances(instances)) {
            try {
                instance.stop();
            } catch (Exception e) {
                exception.addException(e);
            }
        }
        exception.throwIfExceptions();
        return null;
    }
View Full Code Here

    static final String DEBUG_OPTS = " -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005";
    static final String DEFAULT_OPTS = "-server -Xmx512M -Dcom.sun.management.jmxremote";

    protected Object doExecute() throws Exception {
        MultiException exception = new MultiException("Error starting instance(s)");
        List<Instance> toWaitFor = new ArrayList<>();
        for (Instance instance : getMatchingInstances(instances)) {
            try {
                String opts = javaOpts;
                if (opts == null) {
                    opts = instance.getJavaOpts();
                }
                if (opts == null) {
                    opts = DEFAULT_OPTS;
                }
                if (debug) {
                    opts += DEBUG_OPTS;
                }
                if (wait) {
                    String state = instance.getState();
                    if (Instance.STOPPED.equals(state)) {
                        instance.start(opts);
                        toWaitFor.add(instance);
                    }
                } else {
                    instance.start(opts);
                }
            } catch (Exception e) {
                exception.addException(e);
            }
        }
        exception.throwIfExceptions();
        while (true) {
            boolean allStarted = true;
            for (Instance child : toWaitFor) {
                allStarted &= Instance.STARTED.equals(child.getState());
            }
View Full Code Here

    @Argument(index = 0, name = "name", description= "The name of the container instance to destroy", required = true, multiValued = true)
    @Completion(InstanceCompleter.class)
    private List<String> instances = null;

    protected Object doExecute() throws Exception {
        final MultiException exception = new MultiException("Error destroying instance(s)");
        for (Instance instance : getMatchingInstances(instances)) {
            try {
                instance.destroy();
            } catch (Exception e) {
                exception.addException(e);
            }
        }
        exception.throwIfExceptions();
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.support.MultiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.