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

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

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

Channel.preloadJar介绍

[英]Preloads jar files on the remote side.

This is a performance improvement method that can be safely ignored if your goal is just to make things working.

Normally, classes are transferred over the network one at a time, on-demand. This design is mainly driven by how Java classloading works — we can't predict what classes will be necessarily upfront very easily.

Classes are loaded only once, so for long-running Channel, this is normally an acceptable overhead. But sometimes, for example when a channel is short-lived, or when you know that you'll need a majority of classes in certain jar files, then it is more efficient to send a whole jar file over the network upfront and thereby avoiding individual class transfer over the network.

That is what this method does. It ensures that a series of jar files are copied to the remote side (AKA "preloading.") Classloading will consult the preloaded jars before performing network transfer of class files.
[中]在远程端预加载jar文件。
如果你的目标仅仅是让事情运转起来,那么这是一种可以安全地忽略的性能改进方法。
通常,课程通过网络按需一次传送一个。这种设计主要是由Java类加载的工作方式驱动的——我们无法很容易地预测哪些类需要预先加载。
类只加载一次,所以对于长时间运行的通道,这通常是一个可接受的开销。但有时,例如,当一个通道是短期的,或者当您知道您需要某些jar文件中的大多数类时,通过网络预先发送整个jar文件会更有效,从而避免通过网络传输单个类。
这就是这种方法的作用。它确保将一系列jar文件复制到远程端(也称为“预加载”)在执行类文件的网络传输之前,类加载将参考预加载的JAR。

代码示例

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

public Boolean call() throws IOException {
    try {
      return Channel.current().preloadJar(this, Ivy.class);
    } catch (InterruptedException e) {
    }
    return false;
  }
}

代码示例来源:origin: org.hudsonci.plugins/ivy

public Boolean call() throws IOException {
    try {
      return Channel.current().preloadJar(this, Ivy.class);
    } catch (InterruptedException e) {
    }
    return false;
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

public Boolean call() throws IOException {
    try {
      return Channel.current().preloadJar(this, Ivy.class);
    } catch (InterruptedException e) {
    }
    return false;
  }
}

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

return preloadJar(UserRequest.getClassLoader(classLoaderRef), classesInJar);

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

return preloadJar(UserRequest.getClassLoader(classLoaderRef), classesInJar);

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

return preloadJar(UserRequest.getClassLoader(classLoaderRef), classesInJar);

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

return preloadJar(UserRequest.getClassLoader(classLoaderRef), classesInJar);

代码示例来源:origin: org.jenkins-ci.plugins/bouncycastle-api

} else {
  channel.preloadJar(PEMEncodable.class.getClassLoader(), BouncyCastleProvider.class);

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

public void testPrefetch() throws Exception {
  VerifyTask vt = new VerifyTask();
  assertTrue( channel.preloadJar(vt,ClassReader.class));
  assertFalse(channel.preloadJar(vt,ClassReader.class));
  // TODO: how can I do a meaningful test of this feature?
  System.out.println(channel.call(vt));
}

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

IvyXmlParser parser = new IvyXmlParser(listener, project, settings, getModuleRoot().getRemote());
  if (getModuleRoot().getChannel() instanceof Channel)
    ((Channel) getModuleRoot().getChannel()).preloadJar(parser, Ivy.class);
  ivyDescriptors = getModuleRoot().act(parser);
} catch (IOException e) {

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

IvyXmlParser parser = new IvyXmlParser(listener, project, getModuleRoot().getRemote());
  if (getModuleRoot().getChannel() instanceof Channel)
    ((Channel) getModuleRoot().getChannel()).preloadJar(parser, Ivy.class);
  ivyDescriptors = getModuleRoot().act(parser);
} catch (IOException e) {

代码示例来源:origin: org.hudsonci.plugins/ivy

IvyXmlParser parser = new IvyXmlParser(listener, project, getModuleRoot().getRemote());
  if (getModuleRoot().getChannel() instanceof Channel)
    ((Channel) getModuleRoot().getChannel()).preloadJar(parser, Ivy.class);
  ivyDescriptors = getModuleRoot().act(parser);
} catch (IOException e) {

相关文章