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

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

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

Channel.waitForProperty介绍

[英]Works like #getProperty(Object) but wait until some value is set by someone.
[中]工作原理类似于#getProperty(Object),但要等到有人设置了某个值。

代码示例

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

public <T> T waitForProperty(ChannelProperty<T> key) throws InterruptedException {
  return key.type.cast(waitForProperty((Object) key));
}

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

public Void call() throws Exception {
    try {
      RegistrationRequest c = new RegistrationRequest(ConfigurationBuilder.buildNodeConfig(args), nodeName);

      for (MutableCapabilities dc : c.getConfiguration().capabilities) {
        JenkinsCapabilityMatcher.enhanceCapabilities(dc, nodeName);
      }
      SelfRegisteringRemote remote = new SelfRegisteringRemote(c);
      remote.setRemoteServer(new SeleniumServer(c.getConfiguration()));
      PropertyUtils.setProperty(SeleniumConstants.PROPERTY_INSTANCE, remote);
      remote.startRemoteServer();
      remote.startRegistrationProcess();

      Channel.current().waitForProperty(SeleniumConstants.PROPERTY_LOCK);
      return null;
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      throw e;
    } catch (Error e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      throw e;
    }
  }
}

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

public void testGetSetProperty() throws Exception {
  channel.setProperty("foo","bar");
  assertEquals("bar", channel.getProperty("foo"));
  assertEquals("bar",channel.waitForProperty("foo"));
  ChannelProperty<Class> typedProp = new ChannelProperty<Class>(Class.class,"a type-safe property");
  channel.setProperty(typedProp, Void.class);
  assertEquals(Void.class, channel.getProperty(typedProp));
  assertEquals(Void.class, channel.waitForProperty(typedProp));
}

相关文章