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

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

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

Util.checkIfValidAddress介绍

暂无

代码示例

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

/**
 * Makes sure that all fields annotated with @LocalAddress is (1) an InetAddress and (2) a valid address on any
 * local network interface
 * @param protocols
 * @throws Exception
 */
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception {
  for(Protocol protocol : protocols) {
    String protocolName=protocol.getName();
    //traverse class hierarchy and find all annotated fields and add them to the list if annotated
    Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), LocalAddress.class);
    for(int i=0; i < fields.length; i++) {
      Object val=getValueFromProtocol(protocol, fields[i]);
      if(val == null)
        continue;
      if(!(val instanceof InetAddress))
        throw new Exception("field " + protocolName + "." + fields[i].getName() + " is not an InetAddress");
      Util.checkIfValidAddress((InetAddress)val, protocolName);
    }
  }
}

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

throw new IllegalArgumentException("bind_addr cannot be null") ;
Util.checkIfValidAddress(bind_addr, getName());
if(log.isDebugEnabled()) log.debug("sockets will use interface " + bind_addr.getHostAddress());

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

/**
 * Makes sure that all fields annotated with @LocalAddress is (1) an InetAddress and (2) a valid address on any
 * local network interface
 * @param protocols
 * @throws Exception
 */
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception {
  for(Protocol protocol : protocols) {
    String protocolName=protocol.getName();
    //traverse class hierarchy and find all annotated fields and add them to the list if annotated
    Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), LocalAddress.class);
    for(int i=0; i < fields.length; i++) {
      Object val=getValueFromProtocol(protocol, fields[i]);
      if(val == null)
        continue;
      if(!(val instanceof InetAddress))
        throw new Exception("field " + protocolName + "." + fields[i].getName() + " is not an InetAddress");
      Util.checkIfValidAddress((InetAddress)val, protocolName);
    }
  }
}

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

throw new IllegalArgumentException("bind_addr cannot be null") ;
Util.checkIfValidAddress(bind_addr, getName());
if(log.isDebugEnabled()) log.debug("sockets will use interface " + bind_addr.getHostAddress());

相关文章

Util类方法