Package hudson.remoting

Examples of hudson.remoting.Channel$ReaderThread


            if(profile) {
                NumberFormat n = NumberFormat.getInstance();
                PrintStream logger = listener.getLogger();
                logger.println("Total overhead was "+format(n,a.overheadTime)+"ms");
                Channel ch = Channel.current();
                logger.println("Class loading "   +format(n,ch.classLoadingTime.get())   +"ms, "+ch.classLoadingCount+" classes");
                logger.println("Resource loading "+format(n,ch.resourceLoadingTime.get())+"ms, "+ch.resourceLoadingCount+" times");               
            }

            if(r==0)    return Result.SUCCESS;
View Full Code Here


            if(profile) {
                NumberFormat n = NumberFormat.getInstance();
                PrintStream logger = listener.getLogger();
                logger.println("Total overhead was "+format(n,mavenExecutionListener.overheadTime)+"ms");
                Channel ch = Channel.current();
                logger.println("Class loading "   +format(n,ch.classLoadingTime.get())   +"ms, "+ch.classLoadingCount+" classes");
                logger.println("Resource loading "+format(n,ch.resourceLoadingTime.get())+"ms, "+ch.resourceLoadingCount+" times");               
            }

            mavenExecutionResult = Maven3Launcher.getMavenExecutionResult();
View Full Code Here

        if(!url.endsWith("/"))  url+='/';

        ownsPool = exec==null;
        pool = exec!=null ? exec : Executors.newCachedThreadPool();

        Channel channel = null;
        InetSocketAddress clip = getCliTcpPort(url);
        if(clip!=null) {
            // connect via CLI port
            try {
                channel = connectViaCliPort(jenkins, clip);
            } catch (IOException e) {
                LOGGER.log(Level.FINE,"Failed to connect via CLI port. Falling back to HTTP",e);
            }
        }
        if (channel==null) {
            // connect via HTTP
            channel = connectViaHttp(url);
        }
        this.channel = channel;

        // execute the command
        entryPoint = (CliEntryPoint)channel.waitForRemoteProperty(CliEntryPoint.class.getName());

        if(entryPoint.protocolVersion()!=CliEntryPoint.VERSION)
            throw new IOException(Messages.CLI_VersionMismatch());
    }
View Full Code Here

        LOGGER.fine("Trying to connect to "+url+" via HTTP");
        url+="cli";
        URL jenkins = new URL(url);

        FullDuplexHttpStream con = new FullDuplexHttpStream(jenkins,authorization);
        Channel ch = new Channel("Chunked connection to "+jenkins,
                pool,con.getInputStream(),con.getOutputStream());
        final long interval = 15*1000;
        final long timeout = (interval * 3) / 4;
        new PingThread(ch,timeout,interval) {
            protected void onDead() {
View Full Code Here

        });

        DataOutputStream dos = new DataOutputStream(s.getOutputStream());
        dos.writeUTF("Protocol:CLI-connect");

        return new Channel("CLI connection to "+jenkins, pool,
                new BufferedInputStream(new SocketInputStream(s)),
                new BufferedOutputStream(out));
    }
View Full Code Here

         * Before we touch I/O streams, we need to make sure all the remote I/O operations are locally completed,
         * or else we end up switching the log traffic at unaligned moments.
         */
        private void sync() throws IOException {
            try {
                Channel ch = Channel.current();
                if (ch!=null)
                    listener.synchronizeOnMark(ch);
            } catch (InterruptedException e) {
                // our signature doesn't allow us to throw InterruptedException, so we process it later
                Thread.currentThread().interrupt();
View Full Code Here

        }

        try {

            // listener.getLogger().println("Creating selenium VM");
            Channel jvm = SeleniumProcessUtils.createSeleniumRCVM(localJar, listener, options.getJVMArguments(), options.getEnvironmentVariables());
            status = new RemoteRunningStatus(jvm, options);
            status.setStatus(SeleniumConstants.STARTING);

            List<String> arguments = new ArrayList<String>(options.getSeleniumArguments().size());
            for (ProcessArgument arg : options.getSeleniumArguments()) {
                arguments.addAll(arg.toArgumentsList());
            }

            // listener.getLogger().println("Starting the selenium process");
            jvm.callAsync(new RemoteControlLauncher(nodeName, (String[]) ArrayUtils.addAll(defaultArgs, arguments.toArray(new String[0]))));
            status.setStatus(SeleniumConstants.STARTED);
            status.setRunning(true);
        } catch (Exception t) {
            status.setRunning(false);
            status.setStatus(SeleniumConstants.ERROR);
View Full Code Here

     *      Gets a notification when the channel closes, to perform clean up. Can be null.
     *      By the time this method is called, the cause of the termination is reported to the user,
     *      so the implementation of the listener doesn't need to do that again.
     */
    public void setChannel(InputStream in, OutputStream out, OutputStream launchLog, Channel.Listener listener) throws IOException, InterruptedException {
        Channel channel = new Channel(nodeName,threadPoolForRemoting, Channel.Mode.NEGOTIATE, in,out, launchLog);
        setChannel(channel,launchLog,listener);
    }
View Full Code Here

    /**
     * If still connected, disconnect.
     */
    private void closeChannel() {
        // TODO: race condition between this and the setChannel method.
        Channel c = channel;
        channel = null;
        isUnix = null;
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                logger.log(Level.SEVERE, "Failed to terminate channel to " + getDisplayName(), e);
            }
            for (ComputerListener cl : ComputerListener.all())
                cl.onOffline(this);
View Full Code Here

    public static VirtualChannel getChannelToMaster() {
        if (Jenkins.getInstance()!=null)
            return MasterComputer.localChannel;

        // if this method is called from within the slave computation thread, this should work
        Channel c = Channel.current();
        if (c!=null && Boolean.TRUE.equals(c.getProperty("slave")))
            return c;

        return null;
    }
View Full Code Here

TOP

Related Classes of hudson.remoting.Channel$ReaderThread

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.