org.jgroups.util.Util.parseCommaDelimitedStrings()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(136)

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

Util.parseCommaDelimitedStrings介绍

[英]e.g. "bela,jeannette,michelle" --> List{"bela", "jeannette", "michelle"}
[中]e、 g.“贝拉、珍妮特、米歇尔”->列表{“贝拉”、“珍妮特”、“米歇尔”}

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Parses a var which might be comma delimited, e.g. bla,foo:1000: if 'bla' is set, return its value. Else,
 * if 'foo' is set, return its value, else return "1000"
 * @param var
 * @param default_value
 * @return
 */
private static String _getProperty(String var,String default_value) {
  if(var == null)
    return null;
  List<String> list=parseCommaDelimitedStrings(var);
  if(list == null || list.isEmpty()) {
    list=new ArrayList<>(1);
    list.add(var);
  }
  String retval=null;
  for(String prop : list) {
    try {
      retval=System.getProperty(prop);
      if(retval != null)
        return retval;
      if((retval=System.getenv(prop)) != null)
        return retval;
    }
    catch(Throwable ignored) {
    }
  }
  return default_value;
}

代码示例来源:origin: wildfly/wildfly

public void onInfo(Map<String, String> information) {
  String view=information.get("view");
  Collection<String> list;
  if(view != null) {
    list=Util.parseCommaDelimitedStrings(view);
    if(list != null) {
      num_servers=list.size();
      if(mainFrame != null)
        setTitle();
      servers.clear();
      servers.addAll(list);
    }
    else {
      String targets=information.get("endpoints");
      if(targets != null) {
        list=Util.parseCommaDelimitedStrings(targets);
        if(list != null) {
          num_servers=list.size();
          if(mainFrame != null)
            setTitle();
          servers.clear();
          servers.addAll(list);
        }
      }
    }
  }
}

代码示例来源:origin: wildfly/wildfly

@Property(description="Max times to block for the listed messages sizes (Message.getLength()). Example: \"1000:10,5000:30,10000:500\"")
public void setMaxBlockTimes(String str) {
  if(str == null) return;
  Long prev_key=null, prev_val=null;
  List<String> vals=Util.parseCommaDelimitedStrings(str);
  if(max_block_times == null)
    max_block_times=new TreeMap<>();
  for(String tmp: vals) {
    int index=tmp.indexOf(':');
    if(index == -1)
      throw new IllegalArgumentException("element '" + tmp + "'  is missing a ':' separator");
    Long key=Long.parseLong(tmp.substring(0, index).trim());
    Long val=Long.parseLong(tmp.substring(index +1).trim());
    // sanity checks:
    if(key < 0 || val < 0)
      throw new IllegalArgumentException("keys and values must be >= 0");
    if(prev_key != null && key <= prev_key)
      throw new IllegalArgumentException("keys are not sorted: " + vals);
    prev_key=key;
    if(prev_val != null && val <= prev_val)
      throw new IllegalArgumentException("values are not sorted: " + vals);
    prev_val=val;
    max_block_times.put(key, val);
  }
  log.debug("max_block_times: %s", max_block_times);
}

代码示例来源:origin: wildfly/wildfly

public void onInfo(Map<String, String> information) {
   String view=information.get("view");
   Collection<String> list;
   if(view != null) {
     list=Util.parseCommaDelimitedStrings(view);
     if(list != null) {
       num_servers=list.size();
       if(mainFrame != null)
         setTitle();
       servers.clear();
       servers.addAll(list);
       newView(view);
     }
     else {
       String targets=information.get(ENDPOINTS);
       if(targets != null) {
         list=Util.parseCommaDelimitedStrings(targets);
         if(list != null) {
           num_servers=list.size();
           if(mainFrame != null)
             setTitle();
           servers.clear();
           servers.addAll(list);
         }
       }
     }
   }
  
 }

代码示例来源:origin: wildfly/wildfly

List<String> addrs=Util.parseCommaDelimitedStrings(propertyValue);
for(String addr: addrs) {
  try {

代码示例来源:origin: wildfly/wildfly

String all_clients=headers.get(CLIENTS_KW);
if(all_clients != null) {
  List<String> list=Util.parseCommaDelimitedStrings(all_clients);
  if(list != null) {
    synchronized(clients) {
String tmp=headers.get(USERS_KW);
if(tmp != null) {
  List<String> list=Util.parseCommaDelimitedStrings(tmp);
  if(list != null)
    usersReceived(list);

代码示例来源:origin: wildfly/wildfly

if(end_index == -1)
  throw new IllegalArgumentException("] not found");
List<String> str_args=Util.parseCommaDelimitedStrings(operation.substring(args_index + 1, end_index));
Object[] strings=str_args.toArray();
args=new String[strings.length];

代码示例来源:origin: wildfly/wildfly

List<String> list=Util.parseCommaDelimitedStrings(all_clients);
if(list != null) {
  synchronized(clients) {

代码示例来源:origin: wildfly/wildfly

String rest=key.substring(index +1);
if(rest != null && !rest.isEmpty()) {
  List<String> prots=Util.parseCommaDelimitedStrings(rest);
  if(!prots.isEmpty()) {
    for(String p: prots) {

代码示例来源:origin: wildfly/wildfly

String endpoints=frame.getHeaders().get("endpoints");
if(endpoints != null) {
  List<String> list=Util.parseCommaDelimitedStrings(endpoints);
  if(list != null) {
    boolean changed=server_destinations.addAll(list);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Parses a var which might be comma delimited, e.g. bla,foo:1000: if 'bla' is set, return its value. Else,
 * if 'foo' is set, return its value, else return "1000"
 * @param var
 * @param default_value
 * @return
 */
private static String _getProperty(String var,String default_value) {
  if(var == null)
    return null;
  List<String> list=parseCommaDelimitedStrings(var);
  if(list == null || list.isEmpty()) {
    list=new ArrayList<>(1);
    list.add(var);
  }
  String retval=null;
  for(String prop : list) {
    try {
      retval=System.getProperty(prop);
      if(retval != null)
        return retval;
      if((retval=System.getenv(prop)) != null)
        return retval;
    }
    catch(Throwable e) {
    }
  }
  return default_value;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void onInfo(Map<String, String> information) {
  String view=information.get("view");
  Collection<String> list;
  if(view != null) {
    list=Util.parseCommaDelimitedStrings(view);
    if(list != null) {
      num_servers=list.size();
      if(mainFrame != null)
        setTitle();
      servers.clear();
      servers.addAll(list);
    }
    else {
      String targets=information.get("endpoints");
      if(targets != null) {
        list=Util.parseCommaDelimitedStrings(targets);
        if(list != null) {
          num_servers=list.size();
          if(mainFrame != null)
            setTitle();
          servers.clear();
          servers.addAll(list);
        }
      }
    }
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Property(description="Max times to block for the listed messages sizes (Message.getLength()). Example: \"1000:10,5000:30,10000:500\"")
public void setMaxBlockTimes(String str) {
  if(str == null) return;
  Long prev_key=null, prev_val=null;
  List<String> vals=Util.parseCommaDelimitedStrings(str);
  if(max_block_times == null)
    max_block_times=new TreeMap<>();
  for(String tmp: vals) {
    int index=tmp.indexOf(':');
    if(index == -1)
      throw new IllegalArgumentException("element '" + tmp + "'  is missing a ':' separator");
    Long key=Long.parseLong(tmp.substring(0, index).trim());
    Long val=Long.parseLong(tmp.substring(index +1).trim());
    // sanity checks:
    if(key < 0 || val < 0)
      throw new IllegalArgumentException("keys and values must be >= 0");
    if(prev_key != null && key <= prev_key)
      throw new IllegalArgumentException("keys are not sorted: " + vals);
    prev_key=key;
    if(prev_val != null && val <= prev_val)
      throw new IllegalArgumentException("values are not sorted: " + vals);
    prev_val=val;
    max_block_times.put(key, val);
  }
  log.debug("max_block_times: %s", max_block_times);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void onInfo(Map<String, String> information) {
   String view=information.get("view");
   Collection<String> list;
   if(view != null) {
     list=Util.parseCommaDelimitedStrings(view);
     if(list != null) {
       num_servers=list.size();
       if(mainFrame != null)
         setTitle();
       servers.clear();
       servers.addAll(list);
       newView(view);
     }
     else {
       String targets=information.get(ENDPOINTS);
       if(targets != null) {
         list=Util.parseCommaDelimitedStrings(targets);
         if(list != null) {
           num_servers=list.size();
           if(mainFrame != null)
             setTitle();
           servers.clear();
           servers.addAll(list);
         }
       }
     }
   }
  
 }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

List<String> addrs=Util.parseCommaDelimitedStrings(propertyValue);
for(String addr: addrs) {
  try {

代码示例来源:origin: org.jboss.eap/wildfly-client-all

List<String> list=Util.parseCommaDelimitedStrings(all_clients);
if(list != null) {
  synchronized(clients) {

代码示例来源:origin: org.jboss.eap/wildfly-client-all

String all_clients=headers.get(CLIENTS_KW);
if(all_clients != null) {
  List<String> list=Util.parseCommaDelimitedStrings(all_clients);
  if(list != null) {
    synchronized(clients) {
String tmp=headers.get(USERS_KW);
if(tmp != null) {
  List<String> list=Util.parseCommaDelimitedStrings(tmp);
  if(list != null)
    usersReceived(list);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

if(end_index == -1)
  throw new IllegalArgumentException("] not found");
List<String> str_args=Util.parseCommaDelimitedStrings(operation.substring(args_index + 1, end_index));
Object[] strings=str_args.toArray();
args=new String[strings.length];

代码示例来源:origin: org.jboss.eap/wildfly-client-all

String rest=key.substring(index +1);
if(rest != null && !rest.isEmpty()) {
  List<String> prots=Util.parseCommaDelimitedStrings(rest);
  if(!prots.isEmpty()) {
    for(String p: prots) {

代码示例来源:origin: org.jboss.eap/wildfly-client-all

String endpoints=frame.getHeaders().get("endpoints");
if(endpoints != null) {
  List<String> list=Util.parseCommaDelimitedStrings(endpoints);
  if(list != null) {
    boolean changed=server_destinations.addAll(list);

相关文章

Util类方法