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;
343
* Shows {@link Channel#classLoadingCount}.
346
public int getClassLoadingCount() throws IOException, InterruptedException {
347
return channel.call(new LoadingCount(false));
351
* Shows {@link Channel#resourceLoadingCount}.
354
public int getResourceLoadingCount() throws IOException, InterruptedException {
355
return channel.call(new LoadingCount(true));
359
* Shows {@link Channel#classLoadingTime}.
362
public long getClassLoadingTime() throws IOException, InterruptedException {
363
return channel.call(new LoadingTime(false));
367
* Shows {@link Channel#resourceLoadingTime}.
370
public long getResourceLoadingTime() throws IOException, InterruptedException {
371
return channel.call(new LoadingTime(true));
374
static class LoadingCount implements Callable<Integer,RuntimeException> {
375
private final boolean resource;
376
LoadingCount(boolean resource) {
377
this.resource = resource;
379
@Override public Integer call() {
380
Channel c = Channel.current();
381
return resource ? c.resourceLoadingCount.get() : c.classLoadingCount.get();
385
static class LoadingTime implements Callable<Long,RuntimeException> {
386
private final boolean resource;
387
LoadingTime(boolean resource) {
388
this.resource = resource;
390
@Override public Long call() {
391
Channel c = Channel.current();
392
return resource ? c.resourceLoadingTime.get() : c.classLoadingTime.get();
344
397
* Sets up the connection through an exsting channel.
433
486
if(channel==null)
434
487
return Collections.emptyList();
436
return channel.call(new Callable<List<LogRecord>,RuntimeException>() {
437
public List<LogRecord> call() {
438
return new ArrayList<LogRecord>(SLAVE_LOG_HANDLER.getView());
489
return channel.call(new SlaveLogFetcher());
443
492
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException {
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);