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

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

本文整理了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

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

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

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

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

  1. @Override
  2. public Object call() throws InterruptedException {
  3. Channel.currentOrFail().syncLocalIO();
  4. return null;
  5. }

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

  1. public ISaturationTest call() throws IOException {
  2. return Channel.currentOrFail().export(ISaturationTest.class, new ISaturationTest() {
  3. private InputStream in;
  4. public void ensureConnected() throws IOException {
  5. in = pipe.getIn();
  6. }
  7. public int readFirst() throws IOException {
  8. return in.read();
  9. }
  10. public void readRest() throws IOException {
  11. new DataInputStream(in).readFully(new byte[Channel.PIPE_WINDOW_SIZE*2]);
  12. }
  13. });
  14. }
  15. }

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

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

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

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

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

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

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

  1. public Void call() throws IOException {
  2. try {
  3. final Channel ch = Channel.currentOrFail();
  4. final JarCache jarCache = ch.getJarCache();
  5. if (jarCache == null) {
  6. throw new IOException("Cannot Force JAR load, JAR cache is disabled");
  7. }
  8. jarCache.resolve(ch,sum1,sum2).get();
  9. return null;
  10. } catch (InterruptedException e) {
  11. throw new IOException(e);
  12. } catch (ExecutionException e) {
  13. throw new IOException(e);
  14. }
  15. }
  16. }

相关文章