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

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

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

Util.getIpStackType介绍

暂无

代码示例

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

  1. protected void bindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcast_addr) throws IOException {
  2. SocketAddress tmp_mcast_addr=new InetSocketAddress(mcast_addr, mcast_port);
  3. for(Iterator it=interfaces.iterator(); it.hasNext();) {
  4. NetworkInterface i=(NetworkInterface)it.next();
  5. for(Enumeration en2=i.getInetAddresses(); en2.hasMoreElements();) {
  6. InetAddress addr=(InetAddress)en2.nextElement();
  7. if ((Util.getIpStackType() == StackType.IPv4 && addr instanceof Inet4Address)
  8. || (Util.getIpStackType() == StackType.IPv6 && addr instanceof Inet6Address)) {
  9. s.joinGroup(tmp_mcast_addr, i);
  10. log.trace("joined " + tmp_mcast_addr + " on " + i.getName() + " (" + addr + ")");
  11. break;
  12. }
  13. }
  14. }
  15. }

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

  1. public static InetAddress getLocalhost() throws UnknownHostException {
  2. return getLocalhost(Util.getIpStackType());
  3. }

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

  1. StackType ip_version=Util.getIpStackType();
  2. for(Enumeration addresses=intf.getInetAddresses(); addresses.hasMoreElements(); ) {
  3. InetAddress addr=(InetAddress)addresses.nextElement();

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

  1. public static void setDefaultValues(List<Protocol> protocols) throws Exception {
  2. if(protocols == null)
  3. return;
  4. // check InetAddress related features of stack
  5. Collection<InetAddress> addrs=getInetAddresses(protocols);
  6. StackType ip_version=Util.getIpStackType(); // 0 = n/a, 4 = IPv4, 6 = IPv6
  7. if(!addrs.isEmpty()) {
  8. // check that all user-supplied InetAddresses have a consistent version:
  9. // 1. If an addr is IPv6 and we have an IPv4 stack --> FAIL
  10. // 2. If an address is an IPv4 class D (multicast) address and the stack is IPv6: FAIL
  11. // Else pass
  12. for(InetAddress addr : addrs) {
  13. if(addr instanceof Inet6Address && ip_version == StackType.IPv4)
  14. throw new IllegalArgumentException("found IPv6 address " + addr + " in an IPv4 stack");
  15. if(addr instanceof Inet4Address && addr.isMulticastAddress() && ip_version == StackType.IPv6)
  16. throw new Exception("found IPv4 multicast address " + addr + " in an IPv6 stack");
  17. }
  18. }
  19. // process default values
  20. setDefaultValues(protocols, ip_version);
  21. }

代码示例来源: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: wildfly/wildfly

  1. StackType stack_type=Util.getIpStackType();
  2. boolean ipv6=stack_type == StackType.IPv6;
  3. InetAddress addr=InetAddress.getByName(ipv6? DEFAULT_DIAG_ADDR_IPv6 : DEFAULT_DIAG_ADDR);

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

  1. StackType ip_version=getIpStackType();

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

  1. Collection<InetAddress> addrs=getAddresses(inetAddressMap);
  2. StackType ip_version=Util.getIpStackType();

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

  1. protected void bindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcast_addr) throws IOException {
  2. SocketAddress tmp_mcast_addr=new InetSocketAddress(mcast_addr, mcast_port);
  3. for(Iterator it=interfaces.iterator(); it.hasNext();) {
  4. NetworkInterface i=(NetworkInterface)it.next();
  5. for(Enumeration en2=i.getInetAddresses(); en2.hasMoreElements();) {
  6. InetAddress addr=(InetAddress)en2.nextElement();
  7. if ((Util.getIpStackType() == StackType.IPv4 && addr instanceof Inet4Address)
  8. || (Util.getIpStackType() == StackType.IPv6 && addr instanceof Inet6Address)) {
  9. s.joinGroup(tmp_mcast_addr, i);
  10. log.trace("joined " + tmp_mcast_addr + " on " + i.getName() + " (" + addr + ")");
  11. break;
  12. }
  13. }
  14. }
  15. }

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

  1. public static InetAddress getLocalhost() throws UnknownHostException {
  2. return getLocalhost(Util.getIpStackType());
  3. }

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

  1. StackType ip_version=Util.getIpStackType();
  2. for(Enumeration addresses=intf.getInetAddresses(); addresses.hasMoreElements(); ) {
  3. InetAddress addr=(InetAddress)addresses.nextElement();

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

  1. public static void setDefaultValues(List<Protocol> protocols) throws Exception {
  2. if(protocols == null)
  3. return;
  4. // check InetAddress related features of stack
  5. Collection<InetAddress> addrs=getInetAddresses(protocols);
  6. StackType ip_version=Util.getIpStackType(); // 0 = n/a, 4 = IPv4, 6 = IPv6
  7. if(!addrs.isEmpty()) {
  8. // check that all user-supplied InetAddresses have a consistent version:
  9. // 1. If an addr is IPv6 and we have an IPv4 stack --> FAIL
  10. // 2. If an address is an IPv4 class D (multicast) address and the stack is IPv6: FAIL
  11. // Else pass
  12. for(InetAddress addr : addrs) {
  13. if(addr instanceof Inet6Address && ip_version == StackType.IPv4)
  14. throw new IllegalArgumentException("found IPv6 address " + addr + " in an IPv4 stack");
  15. if(addr instanceof Inet4Address && addr.isMulticastAddress() && ip_version == StackType.IPv6)
  16. throw new Exception("found IPv4 multicast address " + addr + " in an IPv6 stack");
  17. }
  18. }
  19. // process default values
  20. setDefaultValues(protocols, ip_version);
  21. }

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

  1. StackType ip_version=getIpStackType();

代码示例来源: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. }

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

  1. StackType stack_type=Util.getIpStackType();
  2. boolean ipv6=stack_type == StackType.IPv6;
  3. InetAddress addr=InetAddress.getByName(ipv6? DEFAULT_DIAG_ADDR_IPv6 : DEFAULT_DIAG_ADDR);

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

  1. Collection<InetAddress> addrs=getAddresses(inetAddressMap);
  2. StackType ip_version=Util.getIpStackType(); // 0 = n/a, 4 = IPv4, 6 = IPv6

相关文章

Util类方法