本文整理了Java中org.jgroups.util.Util.getAllAvailableInterfaces()
方法的一些代码示例,展示了Util.getAllAvailableInterfaces()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getAllAvailableInterfaces()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:getAllAvailableInterfaces
暂无
代码示例来源:origin: wildfly/wildfly
protected Receiver() throws Exception {
InetSocketAddress saddr=new InetSocketAddress(mcast_addr, mcast_port);
if(can_bind_to_mcast_addr)
mcast_sock=new MulticastSocket(saddr);
else
mcast_sock=new MulticastSocket(mcast_port);
if(bind_addr != null)
bindToInterfaces(Arrays.asList(NetworkInterface.getByInetAddress(bind_addr)), mcast_sock);
else {
List<NetworkInterface> intf_list=Util.getAllAvailableInterfaces();
System.out.println("Joining " + saddr + " on interfaces: " + intf_list);
bindToInterfaces(intf_list, mcast_sock);
}
System.out.println("Socket=" + mcast_sock.getLocalAddress() + ':' + mcast_sock.getLocalPort() + ", bind interface=" +
mcast_sock.getInterface());
}
代码示例来源:origin: wildfly/wildfly
public void start() throws IOException {
// https://jira.jboss.org/jira/browse/JGRP-777 - this doesn't work on MacOS, and we don't have
// cross talking on Windows anyway, so we just do it for Linux. (How about Solaris ?)
// if(can_bind_to_mcast_addr)
// diag_sock=Util.createMulticastSocket(getSocketFactory(),
// Global.TP_DIAG_MCAST_SOCK, diagnostics_addr, diagnostics_port, log);
//else
diag_sock=socket_factory.createMulticastSocket("jgroups.tp.diag.mcast_sock", diagnostics_port);
diag_sock.setTimeToLive(ttl);
List<NetworkInterface> interfaces=bind_interfaces != null? bind_interfaces : Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, diag_sock);
if(thread == null || !thread.isAlive()) {
thread=thread_factory.newThread(this, THREAD_NAME);
thread.setDaemon(true);
thread.start();
}
}
代码示例来源:origin: wildfly/wildfly
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr);
interfaces=send_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
mcast_send_sockets=new MulticastSocket[interfaces.size()];
int index=0;
代码示例来源:origin: wildfly/wildfly
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
void start() throws IOException {
diag_sock=new MulticastSocket(diagnostics_port);
java.util.List interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, diag_sock);
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
thread.setDaemon(true);
thread.start();
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
protected Receiver() throws Exception {
InetSocketAddress saddr=new InetSocketAddress(mcast_addr, mcast_port);
if(can_bind_to_mcast_addr)
mcast_sock=new MulticastSocket(saddr);
else
mcast_sock=new MulticastSocket(mcast_port);
if(bind_addr != null)
bindToInterfaces(Arrays.asList(NetworkInterface.getByInetAddress(bind_addr)), mcast_sock);
else {
List<NetworkInterface> intf_list=Util.getAllAvailableInterfaces();
System.out.println("Joining " + saddr + " on interfaces: " + intf_list);
bindToInterfaces(intf_list, mcast_sock);
}
System.out.println("Socket=" + mcast_sock.getLocalAddress() + ':' + mcast_sock.getLocalPort() + ", bind interface=" +
mcast_sock.getInterface());
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public void start() throws IOException {
// https://jira.jboss.org/jira/browse/JGRP-777 - this doesn't work on MacOS, and we don't have
// cross talking on Windows anyway, so we just do it for Linux. (How about Solaris ?)
// if(can_bind_to_mcast_addr)
// diag_sock=Util.createMulticastSocket(getSocketFactory(),
// Global.TP_DIAG_MCAST_SOCK, diagnostics_addr, diagnostics_port, log);
//else
diag_sock=socket_factory.createMulticastSocket("jgroups.tp.diag.mcast_sock", diagnostics_port);
diag_sock.setTimeToLive(ttl);
List<NetworkInterface> interfaces=bind_interfaces != null? bind_interfaces : Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, diag_sock);
if(thread == null || !thread.isAlive()) {
thread=thread_factory.newThread(this, THREAD_NAME);
thread.setDaemon(true);
thread.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr);
interfaces=send_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
mcast_send_sockets=new MulticastSocket[interfaces.size()];
int index=0;
代码示例来源:origin: org.jboss.eap/wildfly-client-all
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr);
interfaces=send_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
mcast_send_sockets=new MulticastSocket[interfaces.size()];
int index=0;
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());
interfaces=send_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
mcast_send_sockets=new MulticastSocket[interfaces.size()];
int index=0;
代码示例来源:origin: org.jboss.eap/wildfly-client-all
interfaces=receive_interfaces;
else
interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());
内容来源于网络,如有侵权,请联系作者删除!