~ubuntu-branches/ubuntu/saucy/jenkins/saucy-proposed

« back to all changes in this revision

Viewing changes to core/src/main/java/hudson/slaves/SlaveComputer.java

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-13 12:35:19 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130813123519-tizgfxcr70trl7r0
Tags: 1.509.2+dfsg-1
* New upstream release (Closes: #706725):
  - d/control: Update versioned BD's:
    * jenkins-executable-war >= 1.28.
    * jenkins-instance-identity >= 1.3.
    * libjenkins-remoting-java >= 2.23.
    * libjenkins-winstone-java >= 0.9.10-jenkins-44.
    * libstapler-java >= 1.207.
    * libjenkins-json-java >= 2.4-jenkins-1.
    * libstapler-adjunct-timeline-java >= 1.4.
    * libstapler-adjunct-codemirror-java >= 1.2.
    * libmaven-hpi-plugin-java >= 1.93.
    * libjenkins-xstream-java >= 1.4.4-jenkins-3.
  - d/maven.rules: Map to older version of animal-sniffer-maven-plugin.
  - Add patch for compatibility with guava >= 0.14.
  - Add patch to exclude asm4 dependency via jnr-posix.
  - Fixes the following security vulnerabilities:
    CVE-2013-2034, CVE-2013-2033, CVE-2013-2034, CVE-2013-1808
* d/patches/*: Switch to using git patch-queue for managing patches.
* De-duplicate jars between libjenkins-java and jenkins-external-job-monitor
  (Closes: #701163):
  - d/control: Add dependency between jenkins-external-job-monitor ->
    libjenkins-java.
  - d/rules: 
    Drop installation of jenkins-core in jenkins-external-job-monitor.
  - d/jenkins-external-job-monitor.{links,install}: Link to jenkins-core
    in /usr/share/java instead of included version.
* Wait longer for jenkins to stop during restarts (Closes: #704848):
  - d/jenkins.init: Re-sync init script from upstream codebase.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
import javax.servlet.ServletException;
81
81
import javax.servlet.ServletOutputStream;
82
 
import javax.servlet.http.HttpServletResponse;
83
82
import javax.servlet.http.HttpServletResponseWrapper;
84
83
import org.kohsuke.stapler.ResponseImpl;
85
84
import org.kohsuke.stapler.WebMethod;
341
340
    }
342
341
 
343
342
    /**
 
343
     * Shows {@link Channel#classLoadingCount}.
 
344
     * @since 1.495
 
345
     */
 
346
    public int getClassLoadingCount() throws IOException, InterruptedException {
 
347
        return channel.call(new LoadingCount(false));
 
348
    }
 
349
 
 
350
    /**
 
351
     * Shows {@link Channel#resourceLoadingCount}.
 
352
     * @since 1.495
 
353
     */
 
354
    public int getResourceLoadingCount() throws IOException, InterruptedException {
 
355
        return channel.call(new LoadingCount(true));
 
356
    }
 
357
 
 
358
    /**
 
359
     * Shows {@link Channel#classLoadingTime}.
 
360
     * @since 1.495
 
361
     */
 
362
    public long getClassLoadingTime() throws IOException, InterruptedException {
 
363
        return channel.call(new LoadingTime(false));
 
364
    }
 
365
 
 
366
    /**
 
367
     * Shows {@link Channel#resourceLoadingTime}.
 
368
     * @since 1.495
 
369
     */
 
370
    public long getResourceLoadingTime() throws IOException, InterruptedException {
 
371
        return channel.call(new LoadingTime(true));
 
372
    }
 
373
 
 
374
    static class LoadingCount implements Callable<Integer,RuntimeException> {
 
375
        private final boolean resource;
 
376
        LoadingCount(boolean resource) {
 
377
            this.resource = resource;
 
378
        }
 
379
        @Override public Integer call() {
 
380
            Channel c = Channel.current();
 
381
            return resource ? c.resourceLoadingCount.get() : c.classLoadingCount.get();
 
382
        }
 
383
    }
 
384
 
 
385
    static class LoadingTime implements Callable<Long,RuntimeException> {
 
386
        private final boolean resource;
 
387
        LoadingTime(boolean resource) {
 
388
            this.resource = resource;
 
389
        }
 
390
        @Override public Long call() {
 
391
            Channel c = Channel.current();
 
392
            return resource ? c.resourceLoadingTime.get() : c.classLoadingTime.get();
 
393
        }
 
394
    }
 
395
 
 
396
    /**
344
397
     * Sets up the connection through an exsting channel.
345
398
     *
346
399
     * @since 1.444
433
486
        if(channel==null)
434
487
            return Collections.emptyList();
435
488
        else
436
 
            return channel.call(new Callable<List<LogRecord>,RuntimeException>() {
437
 
                public List<LogRecord> call() {
438
 
                    return new ArrayList<LogRecord>(SLAVE_LOG_HANDLER.getView());
439
 
                }
440
 
            });
 
489
            return channel.call(new SlaveLogFetcher());
441
490
    }
442
491
 
443
492
    public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException {
469
518
 
470
519
    public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
471
520
        if(channel!=null) {
472
 
            rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
 
521
            req.getView(this,"already-launched.jelly").forward(req, rsp);
473
522
            return;
474
523
        }
475
524
 
691
740
 
692
741
        return null;
693
742
    }
 
743
 
 
744
    private static class SlaveLogFetcher implements Callable<List<LogRecord>,RuntimeException> {
 
745
        public List<LogRecord> call() {
 
746
            return new ArrayList<LogRecord>(SLAVE_LOG_HANDLER.getView());
 
747
        }
 
748
    }
694
749
}