Package com.aragost.javahg.commands

Examples of com.aragost.javahg.commands.CancelledExecutionException


        }
        this.currentOutputChannelBlock = null;
        BlockInputStream blockInputStream = null;
        while (true) {
            if (cmd.getState() == State.CANCELING) {
                throw new CancelledExecutionException(cmd);
            }

            blockInputStream = new BlockInputStream(this.channelStream);
            char channel = blockInputStream.getChannel();
            switch (channel) {
View Full Code Here


        try {
            server = repository.getServerPool().take(this);
            changeState(State.QUEUED, State.RUNNING, true);
        } catch (InterruptedException e1) {
            changeState(State.CANCELING, State.READY, false);
            throw new CancelledExecutionException(this);
        }

        List<String> commandLine = new ArrayList<String>(this.cmdLine);
        boolean ok = false;

        getRepository().addToCommandLine(commandLine);
        commandLine.addAll(Arrays.asList(args));

        try {
            this.outputChannelStream = server.runCommand(commandLine, this);
            HgInputStream stream = new HgInputStream(outputChannelStream, this.repository.newDecoder());
            ok = true;
            return stream;
        } catch (UnexpectedServerTerminationException e) {
            if (state.get() == State.CANCELING) {
                throw new CancelledExecutionException(this);
            }
            throw e;
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        } finally {
View Full Code Here

     *             If in another unexpected state and if strict is true
     */
    private void changeState(State current, State next, boolean strict) {
        if (!state.compareAndSet(current, next)) {
            if (state.compareAndSet(State.CANCELING, State.READY)) {
                throw new CancelledExecutionException(this);               
            }
            if (strict) {
                throw new ConcurrentModificationException("Unexpected command state");
            }
        }
View Full Code Here

        try {
            server = repository.getServerPool().take(this);
            changeState(State.QUEUED, State.RUNNING, true);
        } catch (InterruptedException e1) {
            changeState(State.CANCELING, State.READY, false);
            throw new CancelledExecutionException(this);
        }

        List<String> commandLine = new ArrayList<String>(this.cmdLine);
        boolean ok = false;

        getRepository().addToCommandLine(commandLine);
        commandLine.addAll(Arrays.asList(args));

        try {
            this.outputChannelStream = server.runCommand(commandLine, this);
            HgInputStream stream = new HgInputStream(outputChannelStream, this.repository.newDecoder());
            ok = true;
            return stream;
        } catch (UnexpectedServerTerminationException e) {
            if (state.get() == State.CANCELING) {
                throw new CancelledExecutionException(this);
            }
            throw e;
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        } finally {
View Full Code Here

     *             If in another unexpected state and if strict is true
     */
    private void changeState(State current, State next, boolean strict) {
        if (!state.compareAndSet(current, next)) {
            if (state.compareAndSet(State.CANCELING, State.READY)) {
                throw new CancelledExecutionException(this);               
            }
            if (strict) {
                throw new ConcurrentModificationException("Unexpected command state");
            }
        }
View Full Code Here

TOP

Related Classes of com.aragost.javahg.commands.CancelledExecutionException

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.