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

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

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

Channel.<init>介绍

暂无

代码示例

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

/**
 * @deprecated Specific to {@link Mode#REMOTING}.
 */
@Deprecated
private Channel connectViaHttp(URL url) throws IOException {
  LOGGER.log(FINE, "Trying to connect to {0} via Remoting over HTTP", url);
  FullDuplexHttpStream con = new FullDuplexHttpStream(url, "cli?remoting=true", authorization);
  Channel ch = new Channel("Chunked connection to " + url,
      pool,con.getInputStream(),con.getOutputStream());
  final long interval = 15*1000;
  final long timeout = (interval * 3) / 4;
  new PingThread(ch,timeout,interval) {
    protected void onDead() {
      // noop. the point of ping is to keep the connection alive
      // as most HTTP servers have a rather short read time out
    }
  }.start();
  return ch;
}

代码示例来源:origin: stackoverflow.com

content = new StringBuilder();
if(localName.equalsIgnoreCase("channel")) {
  channel = new Channel();
} else if(localName.equalsIgnoreCase("item")) {
  inItem = true;

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

return new Channel("CLI connection to "+jenkins, pool,
    new BufferedInputStream(c.in), new BufferedOutputStream(c.out));

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

@Override
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  Pipe out = Pipe.createRemoteToLocal();
  final String workDir = _workDir==null ? null : _workDir.getRemote();
  OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides));
  return new Channel("remotely launched channel on "+channel,
    Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os));
}

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

@Override
protected void run(final InputStream upload, OutputStream download) throws IOException, InterruptedException {
  channel = new Channel("HTTP full-duplex channel " + uuid,
      Computer.threadPoolForRemoting, Mode.BINARY, upload, download, null, restricted);
  // so that we can detect dead clients, periodically send something
  PingThread ping = new PingThread(channel) {
    @Override
    protected void onDead(Throwable diagnosis) {
      LOGGER.log(Level.INFO, "Duplex-HTTP session " + uuid + " is terminated", diagnosis);
      // this will cause the channel to abort and subsequently clean up
      try {
        upload.close();
      } catch (IOException e) {
        // this can never happen
        throw new AssertionError(e);
      }
    }
    @Override
    protected void onDead() {
      onDead(null);
    }
  };
  ping.start();
  main(channel);
  channel.join();
  ping.interrupt();
}

代码示例来源:origin: stackoverflow.com

channel = new Channel();

代码示例来源:origin: stackoverflow.com

channel = new Channel();

代码示例来源:origin: stackoverflow.com

var your_namespace = {};
$(document).ready(function() {
  ...
  your_namespace.channel = new Channel();
  your_namespace.channel.send("helo");
}

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

/**
 * Performs a handshake over the communication channel and builds a {@link Channel}.
 *
 * @param is
 *      Stream connected to the remote peer. It's the caller's responsibility to do
 *      buffering on this stream, if that's necessary.
 * @param os
 *      Stream connected to the remote peer. It's the caller's responsibility to do
 *      buffering on this stream, if that's necessary.
 */
public Channel build(InputStream is, OutputStream os) throws IOException {
  return new Channel(this,negotiate(is,os));
}

代码示例来源:origin: hudson/hudson-2.x

public Channel launchChannel(String[] cmd, OutputStream out, FilePath _workDir, Map<String, String> envVars) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  try {
    Process proc = launcher.launch(Util.join(asList(cmd), " "), _workDir.getRemote());
    return new Channel("channel over named pipe to "+launcher.getHostName(),
      Computer.threadPoolForRemoting, proc.getInputStream(), new BufferedOutputStream(proc.getOutputStream()));
  } catch (JIException e) {
    throw new IOException2(e);
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public Channel launchChannel(String[] cmd, OutputStream out, FilePath _workDir, Map<String, String> envVars) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  try {
    Process proc = launcher.launch(Util.join(asList(cmd), " "), _workDir.getRemote());
    return new Channel("channel over named pipe to "+launcher.getHostName(),
      Computer.threadPoolForRemoting, proc.getInputStream(), new BufferedOutputStream(proc.getOutputStream()));
  } catch (JIException e) {
    throw new IOException2(e);
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Handles CLI connection request.
 */
private void runCliConnect(DataInputStream in, PrintWriter out) throws IOException, InterruptedException {
  out.println("Welcome");
  Channel channel = new Channel("CLI channel from " + s.getInetAddress(),
      Computer.threadPoolForRemoting, Mode.BINARY,
      new BufferedInputStream(new SocketInputStream(this.s)),
      new BufferedOutputStream(new SocketOutputStream(this.s)), null, true);
  channel.setProperty(CliEntryPoint.class.getName(), new CliManagerImpl());
  channel.join();
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Handles CLI connection request.
 */
private void runCliConnect(DataInputStream in, PrintWriter out) throws IOException, InterruptedException {
  out.println("Welcome");
  Channel channel = new Channel("CLI channel from " + s.getInetAddress(),
      Computer.threadPoolForRemoting, Mode.BINARY,
      new BufferedInputStream(new SocketInputStream(this.s)),
      new BufferedOutputStream(new SocketOutputStream(this.s)), null, true);
  channel.setProperty(CliEntryPoint.class.getName(),new CliManagerImpl());
  channel.join();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Handles CLI connection request.
 */
private void runCliConnect(DataInputStream in, PrintWriter out) throws IOException, InterruptedException {
  out.println("Welcome");
  Channel channel = new Channel("CLI channel from " + s.getInetAddress(),
      Computer.threadPoolForRemoting, Mode.BINARY,
      new BufferedInputStream(new SocketInputStream(this.s)),
      new BufferedOutputStream(new SocketOutputStream(this.s)), null, true);
  channel.setProperty(CliEntryPoint.class.getName(),new CliManagerImpl());
  channel.join();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  Pipe out = Pipe.createRemoteToLocal();
  final String workDir = _workDir==null ? null : _workDir.getRemote();
  OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides));
  return new Channel("remotely launched channel on "+channel,
    Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os));
}

代码示例来源:origin: org.jenkins-ci.plugins/ssh-slaves

public Channel launchChannel(String[] cmd, OutputStream out, FilePath _workDir, Map<String, String> envVars) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  final Session session = connection.openSession();
  session.execCommand(makeCommandLine(Arrays.asList(cmd), _workDir));
  return new Channel("channel over ssh on "+connection.getHostname()+":"+connection.getPort(),
    Computer.threadPoolForRemoting, session.getStdout(), new BufferedOutputStream(session.getStdin()));
}

代码示例来源:origin: jenkinsci/ssh-slaves-plugin

public Channel launchChannel(String[] cmd, OutputStream out, FilePath _workDir, Map<String, String> envVars) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  final Session session = connection.openSession();
  session.execCommand(makeCommandLine(Arrays.asList(cmd), _workDir));
  return new Channel("channel over ssh on "+connection.getHostname()+":"+connection.getPort(),
    Computer.threadPoolForRemoting, session.getStdout(), new BufferedOutputStream(session.getStdin()));
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  Pipe out = Pipe.createRemoteToLocal();
  final String workDir = _workDir==null ? null : _workDir.getRemote();
  OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides));
  return new Channel("remotely launched channel on "+channel,
    Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os));
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  Pipe out = Pipe.createRemoteToLocal();
  final String workDir = _workDir==null ? null : _workDir.getRemote();
  OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides));
  return new Channel("remotely launched channel on "+channel,
    Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os));
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String, String> envOverrides) throws IOException, InterruptedException {
  printCommandLine(cmd, _workDir);
  Pipe out = Pipe.createRemoteToLocal();
  final String workDir = _workDir == null ? null : _workDir.getRemote();
  OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides));
  return new Channel("remotely launched channel on " + channel,
      Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os));
}

相关文章