public static Future<Map<String,String>> getThreadDumpAsync(VirtualChannel channel) throws IOException, InterruptedException { if(channel==null) return new AsyncFutureImpl<Map<String, String>>(Collections.singletonMap("N/A","offline")); return channel.callAsync(new GetThreadDump()); }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<T>(callable); for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) { wrapper = factory.wrap(wrapper); } return (channel!=null ? channel : localChannel) .callAsync(wrapper); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException("remote file operation failed",e); } }
Callable<T, ?> cc = createCallable(c); if (cc!=null) futures.put(c,ch.callAsync(cc));
/** * Create a long running task that pipes the Unity3d editor.log into the specified pipe. * <p> * This future can be {@link Future#cancel(boolean) cancelled} in order for the pipe to be closed properly. * @param launcher * @param ros the output stream to write into * @return the number of bytes read * @throws IOException */ public Future<Long> pipeEditorLog(final Launcher launcher, final String customLogFile, final OutputStream ros) throws IOException { return launcher.getChannel().callAsync(new Callable<Long, IOException>() { public Long call() throws IOException { return new PipeFileAfterModificationAction(getEditorLogFile(customLogFile).getAbsolutePath(), ros, true).call(); } }); }
public static Future<Map<String,String>> getThreadDumpAsync(VirtualChannel channel) throws IOException, InterruptedException { if(channel==null) return new AsyncFutureImpl<Map<String, String>>(Collections.singletonMap("N/A","offline")); return channel.callAsync(new GetThreadDump()); }
/** * Reads this file. */ public InputStream read() throws IOException { if(channel==null) return new FileInputStream(new File(remote)); final Pipe p = Pipe.createRemoteToLocal(); channel.callAsync(new Callable<Void,IOException>() { public Void call() throws IOException { FileInputStream fis=null; try { fis = new FileInputStream(new File(remote)); Util.copyStream(fis,p.getOut()); return null; } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(p.getOut()); } } }); return p.getIn(); }
/** * Reads this file. */ public InputStream read() throws IOException { if(channel==null) return new FileInputStream(new File(remote)); final Pipe p = Pipe.createRemoteToLocal(); channel.callAsync(new Callable<Void,IOException>() { public Void call() throws IOException { FileInputStream fis=null; try { fis = new FileInputStream(new File(remote)); Util.copyStream(fis,p.getOut()); return null; } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(p.getOut()); } } }); return p.getIn(); }
/** * Reads this file. */ public InputStream read() throws IOException { if(channel==null) return new FileInputStream(new File(remote)); final Pipe p = Pipe.createRemoteToLocal(); channel.callAsync(new Callable<Void,IOException>() { public Void call() throws IOException { FileInputStream fis=null; try { fis = new FileInputStream(new File(remote)); Util.copyStream(fis,p.getOut()); return null; } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(p.getOut()); } } }); return p.getIn(); }
/** * Reads this file. */ public InputStream read() throws IOException { if (channel == null) { return new FileInputStream(new File(remote)); } final Pipe p = Pipe.createRemoteToLocal(); channel.callAsync(new Callable<Void, IOException>() { public Void call() throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(new File(remote)); Util.copyStream(fis, p.getOut()); return null; } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(p.getOut()); } } }); return p.getIn(); }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { return (channel!=null ? channel : Hudson.MasterComputer.localChannel) .callAsync(new FileCallableWrapper<T>(callable)); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException2("remote file operation failed",e); } }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { return (channel != null ? channel : Hudson.MasterComputer.localChannel) .callAsync(new FileCallableWrapper<T>(callable)); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException2("remote file operation failed", e); } }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { return (channel!=null ? channel : Hudson.MasterComputer.localChannel) .callAsync(new FileCallableWrapper<T>(callable)); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException2("remote file operation failed",e); } }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { return (channel!=null ? channel : Hudson.MasterComputer.localChannel) .callAsync(new FileCallableWrapper<T>(callable)); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException2("remote file operation failed",e); } }
/** * Executes some program on the machine that this {@link FilePath} exists, * so that one can perform local file operations. */ public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException { try { DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<T>(callable); for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) { wrapper = factory.wrap(wrapper); } return (channel!=null ? channel : localChannel) .callAsync(wrapper); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. throw new IOException("remote file operation failed",e); } }
public static Long calculateWorkspaceDiskUsageForPath(FilePath workspace, ArrayList<FilePath> exceeded) throws IOException, InterruptedException{ Long diskUsage = 0l; if(workspace.exists()){ try{ diskUsage = workspace.getChannel().callAsync(new DiskUsageCallable(workspace, exceeded)).get(Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getTimeoutWorkspace(), TimeUnit.MINUTES); } catch(Exception e){ Logger.getLogger(DiskUsageUtil.class.getName()).log(Level.WARNING, "Disk usage fails to calculate workspace for file path " + workspace.getRemote() + " through channel " + workspace.getChannel(),e); } } return diskUsage; }
public boolean perform() throws Exception { FilePath rootFileObject = new FilePath(this.workspace, config.getRootObject()); final DeployerContext deployerContext = new DeployerContext(config, rootFileObject, listener); final VirtualChannel channel = launcher.getChannel(); if (null == channel) throw new IllegalStateException("Null Channel (?)"); final Future<Boolean> booleanFuture = channel.callAsync(new SlaveDeployerCallable(deployerContext)); return booleanFuture.get(); } }
public Proc launch(ProcStarter ps) throws IOException { final OutputStream out = ps.stdout == null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stdout)); final OutputStream err = ps.stderr==null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stderr)); final InputStream in = ps.stdin==null ? null : new RemoteInputStream(ps.stdin); final String workDir = ps.pwd==null ? null : ps.pwd.getRemote(); return new RemoteProc(getChannel().callAsync(new RemoteLaunchCallable(ps.commands, ps.masks, ps.envs, in, out, err, workDir, listener))); }
public Proc launch(ProcStarter ps) throws IOException { final OutputStream out = ps.stdout == null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stdout)); final OutputStream err = ps.stderr==null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stderr)); final InputStream in = ps.stdin==null ? null : new RemoteInputStream(ps.stdin); final String workDir = ps.pwd==null ? null : ps.pwd.getRemote(); return new RemoteProc(getChannel().callAsync(new RemoteLaunchCallable(ps.commands, ps.masks, ps.envs, in, out, err, workDir, listener))); }
public Proc launch(ProcStarter ps) throws IOException { final OutputStream out = ps.stdout == null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stdout)); final OutputStream err = ps.stderr==null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stderr)); final InputStream in = ps.stdin==null ? null : new RemoteInputStream(ps.stdin); final String workDir = ps.pwd==null ? null : ps.pwd.getRemote(); return new RemoteProc(getChannel().callAsync(new RemoteLaunchCallable(ps.commands, ps.masks, ps.envs, in, out, err, workDir, listener))); }
public Proc launch(ProcStarter ps) throws IOException { OutputStream out = null; OutputStream err = null; InputStream in = null; if (ps.stdout != null) { out = new RemoteOutputStream(new CloseProofOutputStream(ps.stdout)); } if (ps.stderr != null) { err = new RemoteOutputStream(new CloseProofOutputStream(ps.stderr)); } if (ps.stdin != null) { in = new RemoteInputStream(ps.stdin); } final String workDir = ps.pwd == null ? null : ps.pwd.getRemote(); return new RemoteProc(getChannel().callAsync(new RemoteLaunchCallable(ps.commands, ps.masks, ps.envs, in, out, err, workDir, listener))); }