本文整理了Java中org.jgroups.util.Util.validateBindAddressFromInterface()
方法的一些代码示例,展示了Util.validateBindAddressFromInterface()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.validateBindAddressFromInterface()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:validateBindAddressFromInterface
[英]Method used by PropertyConverters.BindInterface to check that a bind_address is consistent with a specified interface
Idea: 1. We are passed a bind_addr, which may be null 2. If non-null, check that bind_addr is on bind_interface - if not, throw exception, otherwise, return the original bind_addr 3. If null, get first non-loopback address on bind_interface, using stack preference to get the IP version. If no non-loopback address, then just return null (i.e. the bind_interface did not influence the decision).
[中]属性转换器使用的方法。BindInterface,检查bind_地址是否与指定接口一致
想法:1。我们被传递了一个bind_addr,它可能是null 2。如果非空,检查bind_addr是否在bind_接口上——如果不是,则抛出异常,否则,返回原始的bind_addr 3。如果为null,则在bind_接口上获取第一个非环回地址,使用堆栈首选项获取IP版本。如果没有非环回地址,则只返回null(即bind_接口不影响决策)。
代码示例来源:origin: wildfly/wildfly
public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String propertyValue, boolean check_scope) throws Exception {
// get the existing bind address - possibly null
InetAddress old_bind_addr = (InetAddress)Configurator.getValueFromProtocol((Protocol)obj, "bind_addr");
// apply a bind interface constraint
InetAddress new_bind_addr = Util.validateBindAddressFromInterface(old_bind_addr, propertyValue);
if (new_bind_addr != null)
setBindAddress((Protocol)obj, new_bind_addr) ;
// if no bind_interface specified, set it to the empty string to avoid exception
// from @Property processing
if (propertyValue != null)
return propertyValue ;
else
return "" ;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String propertyValue, boolean check_scope) throws Exception {
// get the existing bind address - possibly null
InetAddress old_bind_addr = (InetAddress)Configurator.getValueFromProtocol((Protocol)obj, "bind_addr");
// apply a bind interface constraint
InetAddress new_bind_addr = Util.validateBindAddressFromInterface(old_bind_addr, propertyValue);
if (new_bind_addr != null)
setBindAddress((Protocol)obj, new_bind_addr) ;
// if no bind_interface specified, set it to the empty string to avoid exception
// from @Property processing
if (propertyValue != null)
return propertyValue ;
else
return "" ;
}
内容来源于网络,如有侵权,请联系作者删除!