コード例 #1
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.msc.value.Value#getValue()
  */
 @Override
 public ProtocolDefaults getValue() {
   ProtocolStackConfigurator configurator = load(ProtocolDefaultsBuilder.this.resource);
   for (org.jgroups.conf.ProtocolConfiguration config : configurator.getProtocolStack()) {
     this.map.put(config.getProtocolName(), Collections.unmodifiableMap(config.getProperties()));
   }
   return this;
 }
コード例 #2
0
  public static String getTcpConfig(String fullTestName, TransportFlags flags) {
    // With the XML already parsed, make a safe copy of the
    // protocol stack configurator and use that accordingly.
    JGroupsProtocolCfg jgroupsCfg = getJGroupsProtocolCfg(tcpConfigurator.getProtocolStack());

    if (!flags.withFD()) removeFailureDetectionTcp(jgroupsCfg);

    if (!flags.isSiteIndexSpecified()) {
      removeRela2(jgroupsCfg);
    } else {
      ProtocolConfiguration protocol = jgroupsCfg.getProtocol(RELAY2);
      protocol.getProperties().put("site", flags.siteName());
      if (flags.relayConfig() != null) // if not specified, use default
      protocol.getProperties().put("config", flags.relayConfig());
    }

    if (!flags.withMerge()) removeMerge(jgroupsCfg);

    if (jgroupsCfg.containsProtocol(TEST_PING)) {
      replaceTcpStartPort(jgroupsCfg, flags);
      if (fullTestName == null) return jgroupsCfg.toString(); // IDE run of test
      else return getTestPingDiscovery(fullTestName, jgroupsCfg); // Cmd line test run
    } else {
      return replaceMCastAddressAndPort(jgroupsCfg);
    }
  }
コード例 #3
0
ファイル: JChannel.java プロジェクト: schaebo/JGroups
  protected final void init(ProtocolStackConfigurator configurator) throws Exception {
    List<ProtocolConfiguration> configs = configurator.getProtocolStack();
    // replace vars with system props
    configs.forEach(ProtocolConfiguration::substituteVariables);

    prot_stack = new ProtocolStack(this);
    prot_stack.setup(configs); // Setup protocol stack (creates protocol, calls init() on them)
  }
コード例 #4
0
  public static String getUdpConfig(String fullTestName, TransportFlags flags) {
    JGroupsProtocolCfg jgroupsCfg = getJGroupsProtocolCfg(udpConfigurator.getProtocolStack());

    if (!flags.withFD()) removeFailureDetectionUdp(jgroupsCfg);

    if (!flags.withMerge()) removeMerge(jgroupsCfg);

    if (!flags.isSiteIndexSpecified()) {
      removeRela2(jgroupsCfg);
    }

    if (jgroupsCfg.containsProtocol(TEST_PING)) {
      if (fullTestName != null)
        return getTestPingDiscovery(fullTestName, jgroupsCfg); // Cmd line test run
    }

    return replaceMCastAddressAndPort(jgroupsCfg);
  }
コード例 #5
0
 @Override
 public String toString() {
   return configurator.getProtocolStackString();
 }
コード例 #6
0
 JGroupsProtocolCfg replaceProtocol(ProtocolType type, ProtocolConfiguration newCfg) {
   ProtocolConfiguration oldCfg = protoMap.get(type);
   int position = configurator.getProtocolStack().indexOf(oldCfg);
   // Remove protocol and put new configuration in same position
   return removeProtocol(type).addProtocol(type, newCfg, position);
 }
コード例 #7
0
 JGroupsProtocolCfg removeProtocol(ProtocolType type) {
   // Update the stack and map
   configurator.getProtocolStack().remove(protoMap.remove(type));
   return this;
 }
コード例 #8
0
 JGroupsProtocolCfg addProtocol(ProtocolType type, ProtocolConfiguration cfg, int position) {
   protoMap.put(type, cfg);
   configurator.getProtocolStack().add(position, cfg);
   return this;
 }