hudson.remoting.Channel.currentOrFail()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中hudson.remoting.Channel.currentOrFail()方法的一些代码示例,展示了Channel.currentOrFail()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.currentOrFail()方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:currentOrFail

Channel.currentOrFail介绍

[英]Gets current channel or fails with IllegalStateException.
[中]获取当前通道或因IllegalStateException失败。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) {
  // remoting sets the context classloader to the RemoteClassLoader,
  // which slows down the classloading. we don't load anything from CLI,
  // so counter that effect.
  Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
  PrintStream out = new PrintStream(stdout);
  PrintStream err = new PrintStream(stderr);
  String subCmd = args.get(0);
  CLICommand cmd = CLICommand.clone(subCmd);
  if(cmd!=null) {
    cmd.channel = Channel.current();
    final CLICommand old = CLICommand.setCurrent(cmd);
    try {
      transportAuth = Channel.currentOrFail().getProperty(CLICommand.TRANSPORT_AUTHENTICATION);
      cmd.setTransportAuth(transportAuth);
      return cmd.main(args.subList(1,args.size()),locale, stdin, out, err);
    } finally {
      CLICommand.setCurrent(old);
    }
  }
  err.println("No such command: "+subCmd);
  new HelpCommand().main(Collections.emptyList(), locale, stdin, out, err);
  return -1;
}

代码示例来源:origin: jenkinsci/remoting

public Void call() throws RuntimeException {
  Channel.currentOrFail().maximumBytecodeLevel = level;
  return null;
}

代码示例来源:origin: jenkinsci/remoting

@Override
public Object call() throws InterruptedException {
  Channel.currentOrFail().syncLocalIO();
  return null;
}

代码示例来源:origin: jenkinsci/remoting

public ISaturationTest call() throws IOException {
    return Channel.currentOrFail().export(ISaturationTest.class, new ISaturationTest() {
      private InputStream in;
      public void ensureConnected() throws IOException {
        in = pipe.getIn();
      }
      public int readFirst() throws IOException {
        return in.read();
      }
      public void readRest() throws IOException {
        new DataInputStream(in).readFully(new byte[Channel.PIPE_WINDOW_SIZE*2]);
      }
    });
  }
}

代码示例来源:origin: jenkinsci/remoting

public Void call() throws IOException {
    Channel.currentOrFail().setJarCache(new FileSystemJarCache(dir, true));
    return null;
  }
}

代码示例来源:origin: jenkinsci/remoting

public String call() throws Exception {
    return Channel.currentOrFail().call(new GunImporter());
  }
}

代码示例来源:origin: jenkinsci/remoting

if(goingHome)   return Channel.currentOrFail().getExportedObject(oid);
else            return proxy;

代码示例来源:origin: jenkinsci/remoting

public Void call() throws IOException {
    try {
      final Channel ch = Channel.currentOrFail();
      final JarCache jarCache = ch.getJarCache();
      if (jarCache == null) {
        throw new IOException("Cannot Force JAR load, JAR cache is disabled");
      }
      jarCache.resolve(ch,sum1,sum2).get();
      return null;
    } catch (InterruptedException e) {
      throw new IOException(e);
    } catch (ExecutionException e) {
      throw new IOException(e);
    }
  }
}

相关文章