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

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

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

Util.getAddressByPatternMatch介绍

[英]Returns a valid interface address based on a pattern. Iterates over all interfaces that are up and returns the first match, based on the address or interface name
[中]根据模式返回有效的接口地址。迭代所有启动的接口,并根据地址或接口名称返回第一个匹配项

代码示例

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

  1. protected static InetAddress convertBindAddress(String value) throws Exception {
  2. InetAddress retval=null;
  3. Util.AddressScope addr_scope=null;
  4. try {
  5. addr_scope=Util.AddressScope.valueOf(value.toUpperCase());
  6. }
  7. catch(Throwable ignored) {
  8. }
  9. if(addr_scope != null)
  10. retval=Util.getAddress(addr_scope);
  11. else {
  12. if(value.startsWith("match"))
  13. retval=Util.getAddressByPatternMatch(value);
  14. else if(value.startsWith("custom:"))
  15. retval=getAddressByCustomCode(value.substring("custom:".length()));
  16. else
  17. retval=InetAddress.getByName(value);
  18. }
  19. if(retval instanceof Inet4Address && retval.isMulticastAddress() && Util.getIpStackType() == StackType.IPv6) {
  20. String tmp=prefix + value;
  21. retval=InetAddress.getByName(tmp);
  22. return retval;
  23. }
  24. return retval;
  25. }

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

  1. protected static InetAddress convertBindAddress(String value) throws Exception {
  2. InetAddress retval=null;
  3. Util.AddressScope addr_scope=null;
  4. try {
  5. addr_scope=Util.AddressScope.valueOf(value.toUpperCase());
  6. }
  7. catch(Throwable ex) {
  8. }
  9. if(addr_scope != null)
  10. retval=Util.getAddress(addr_scope);
  11. else {
  12. if(value.startsWith("match"))
  13. retval=Util.getAddressByPatternMatch(value);
  14. else if(value.startsWith("custom:"))
  15. retval=getAddressByCustomCode(value.substring("custom:".length()));
  16. else
  17. retval=InetAddress.getByName(value);
  18. }
  19. if(retval instanceof Inet4Address && retval.isMulticastAddress() && Util.getIpStackType() == StackType.IPv6) {
  20. String tmp=prefix + value;
  21. retval=InetAddress.getByName(tmp);
  22. return retval;
  23. }
  24. return retval;
  25. }

相关文章

Util类方法