当前位置: 首页>>代码示例>>Java>>正文


Java Callable类代码示例

本文整理汇总了Java中hudson.remoting.Callable的典型用法代码示例。如果您正苦于以下问题:Java Callable类的具体用法?Java Callable怎么用?Java Callable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Callable类属于hudson.remoting包,在下文中一共展示了Callable类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPropertyCallable

import hudson.remoting.Callable; //导入依赖的package包/类
public static Callable<?, ?> getPropertyCallable ( final Object prop )
        throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
    Class<?> reqClass = Class.forName("hudson.remoting.RemoteInvocationHandler$RPCRequest");
    Constructor<?> reqCons = reqClass.getDeclaredConstructor(int.class, Method.class, Object[].class);
    reqCons.setAccessible(true);
    Object getJarLoader = reqCons
            .newInstance(1, Class.forName("hudson.remoting.IChannel").getMethod("getProperty", Object.class), new Object[] {
                prop
    });
    return (Callable<?, ?>) getJarLoader;
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:12,代码来源:JenkinsCLI.java

示例2: executeWithGitSSH

import hudson.remoting.Callable; //导入依赖的package包/类
public static boolean executeWithGitSSH(BuildContext context, SSHUserPrivateKey creds, EnvVars envVars, Callable<Boolean, Exception> callable) throws Exception {
    context.listener.getLogger().println("using GIT_SSH to set credentials " + creds.getDescription());

    FilePath key = createSshKeyFile(context.build.getWorkspace(), creds);
    FilePath ssh = null;
    FilePath pass = null;;

    try {
        if (context.launcher.isUnix()) {
            ssh = createUnixGitSSH(context.build.getWorkspace(), key, creds.getUsername());
            pass = createUnixSshAskpass(context.build.getWorkspace(), creds);
        } else {
            ssh = createWindowsGitSSH(context.build.getWorkspace(), key, creds.getUsername(), envVars);
            pass = createWindowsSshAskpass(context.build.getWorkspace(), creds);
        }

        envVars.put("GIT_SSH", ssh.getRemote());
        envVars.put("SSH_ASKPASS", pass.getRemote());

        if (!envVars.containsKey("DISPLAY")) {
            envVars.put("DISPLAY", ":");
        }

        return callable.call();

    } finally {
        tryDelete(key, context.listener);
        tryDelete(ssh, context.listener);
        tryDelete(pass, context.listener);
    }
}
 
开发者ID:tanium,项目名称:pyjenkins,代码行数:32,代码来源:GitSSHKeyHelper.java

示例3: runGit

import hudson.remoting.Callable; //导入依赖的package包/类
public static boolean runGit(final BuildContext context, final List<String> args, final EnvVars envVars, boolean withAuth) throws Exception, BuildInterruptedException {
    Callable<Boolean, Exception> gitRunner = new Callable<Boolean, Exception>() {
        @Override
        public Boolean call() throws Exception {
            final String gitExe;
            if (JenkinsHelper.isNodeWindows(context)) {
                gitExe = "git.exe";
            } else {
                gitExe = "git";
            }

            // prepend 'git' to the command line args
            args.add(0, gitExe);

            return JenkinsHelper.execute(context, args, envVars);
        }
    };

    if (withAuth) {
        // find the credentials.
        SSHUserPrivateKey theCreds = GitSSHKeyHelper.getSSHCredentials(context, envVars);
        if (theCreds == null) {
            context.listener.getLogger().println("No SSH credentials found");
            return false;
        }

        return GitSSHKeyHelper.executeWithGitSSH(context, theCreds, envVars, gitRunner);
    } else {
        return gitRunner.call();
    }
}
 
开发者ID:tanium,项目名称:pyjenkins,代码行数:32,代码来源:JenkinsHelper.java

示例4: caller

import hudson.remoting.Callable; //导入依赖的package包/类
public static Boolean caller(DockerCLI cli, Callable<Boolean, Throwable> callable) throws Throwable {
    LOG.trace("Calling callable '{}'.", callable);
    assertThat(cli.getChannel(), notNullValue());
    Boolean call = cli.getChannel().call(callable);
    assertThat(call, is(true));
    return call;
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:8,代码来源:JenkinsRuleHelpers.java

示例5: getExecutable

import hudson.remoting.Callable; //导入依赖的package包/类
/**
 * Get executable path of this Drush installation on the given target system.
 */
public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
    return launcher.getChannel().call(new Callable<String,IOException>() {
        public String call() throws IOException {
            File exe = getExeFile();
            return exe.exists() ? exe.getPath() : null;
        }
    });
}
 
开发者ID:jenkinsci,项目名称:drupal-developer-plugin,代码行数:12,代码来源:DrushInstallation.java

示例6: initiateDownloadsAtWorkspace

import hudson.remoting.Callable; //导入依赖的package包/类
private void initiateDownloadsAtWorkspace(
    final GoogleRobotCredentials credentials,
    final Run run, final List<StorageObjectId> objects,
    final FilePath localDir, final TaskListener listener,
    final String version, final String resolvedPrefix)
    throws IOException, InterruptedException {
  try {
    // Use remotable credential to access the storage service from the
    // remote machine.
    final GoogleRobotCredentials remoteCredentials =
        checkNotNull(credentials).forRemote(module.getRequirement());

    localDir.act(
        new Callable<Void, IOException>() {
          @Override
          public Void call() throws IOException {
            performDownloads(remoteCredentials, localDir, objects, listener,
                version, resolvedPrefix);
            return (Void) null;
          }

          @Override
          public void checkRoles(RoleChecker checker)
              throws SecurityException {
            // We know by definition that this is the correct role;
            // the callable exists only in this method context.
          }
        });
  } catch (GeneralSecurityException e) {
    throw new IOException(
        Messages.AbstractUpload_RemoteCredentialError(), e);
  }
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:34,代码来源:DownloadStep.java

示例7: getExecutable

import hudson.remoting.Callable; //导入依赖的package包/类
public String getExecutable(Launcher launcher) throws InterruptedException, IOException {
    return launcher.getChannel().call(new Callable<String, IOException>() {
        public String call() throws IOException {
            File exe = getExeFile();
            if (exe.exists()) {
                return exe.getPath();
            }
            return null;
        }
    });
}
 
开发者ID:jenkinsci,项目名称:packer-plugin,代码行数:12,代码来源:PackerInstallation.java

示例8: getExecutable

import hudson.remoting.Callable; //导入依赖的package包/类
public String getExecutable(Launcher launcher) throws IOException, InterruptedException
{
    return launcher.getChannel().call(new Callable<String,IOException>()
    {
        @Override
        public String call() throws IOException
        {
            File fauxpasFile = new File(getHome(), "fauxpas");
            return fauxpasFile.exists() ? fauxpasFile.getPath() : null;
        }
    });
}
 
开发者ID:FauxPasApp,项目名称:fauxpas-jenkins-plugin,代码行数:13,代码来源:FauxPasAppToolInstallation.java

示例9: getExecutable

import hudson.remoting.Callable; //导入依赖的package包/类
public String getExecutable(Launcher launcher) throws IOException,
		InterruptedException {
	return launcher.getChannel().call(
			new Callable<String, IOException>() {
				private static final long serialVersionUID = 1L;

				public String call() throws IOException {
					File exe = getExeFile();
					if (exe.exists())
						return exe.getPath();
					return null;
				}
			});
}
 
开发者ID:jenkinsci,项目名称:sbuild-plugin,代码行数:15,代码来源:SBuildInstallation.java

示例10: getExecutable

import hudson.remoting.Callable; //导入依赖的package包/类
/**
 * Gets the executable path of this groovy installation on the given target system.
 */
public String getExecutable(final Launcher launcher, final VirtualChannel channel) throws IOException, InterruptedException {
    return channel.call(new Callable<String, IOException>() {
        @Override
        public String call() throws IOException {
            final File exe = getExePath("scala", launcher.isUnix());
            if(exe.exists()) {
                return exe.getPath();
            }
            return null;
        }
    });
}
 
开发者ID:adamretter,项目名称:jenkins-scala-plugin,代码行数:16,代码来源:ScalaInstallation.java

示例11: get

import hudson.remoting.Callable; //导入依赖的package包/类
public static <V, T extends java.lang.Throwable> V get(Node node, WeakHashMap<Node, V> cache, /*MasterToSlave*/Callable<V,T> operation, String name, V defaultIfNull)

            throws IOException {
        V result = get(node, cache, operation, name);
        return result == null ? defaultIfNull : result;
    }
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:7,代码来源:AsyncResultCache.java


注:本文中的hudson.remoting.Callable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。