本文整理了Java中org.jgroups.util.Util.bind()
方法的一些代码示例,展示了Util.bind()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.bind()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:bind
暂无
代码示例来源:origin: wildfly/wildfly
public static void bind(ServerSocket srv_sock, InetAddress bind_addr,
int start_port, int end_port) throws Exception {
bind(srv_sock, bind_addr, start_port, end_port, 50);
}
代码示例来源:origin: wildfly/wildfly
public static void bind(final ServerSocketChannel ch, InetAddress bind_addr, int start_port, int end_port) throws Exception {
bind(ch, bind_addr, start_port, end_port, 50);
}
代码示例来源:origin: wildfly/wildfly
public static ServerSocketChannel createServerSocketChannelAndBind(InetAddress bind_addr,
int start_port, int end_port) throws Exception {
ServerSocketChannel channel=ServerSocketChannel.open();
bind(channel, bind_addr, start_port, end_port);
return channel;
}
代码示例来源:origin: wildfly/wildfly
protected static int getNextTCPPort(InetAddress bind_addr, int start_port) throws Exception {
try(ServerSocket sock=new ServerSocket()) {
sock.setReuseAddress(false);
Util.bind(sock, bind_addr, start_port, start_port+100);
return sock.getLocalPort();
}
}
代码示例来源:origin: wildfly/wildfly
public static ServerSocket createServerSocket(SocketFactory factory, String service_name, InetAddress bind_addr, int start_port) {
ServerSocket ret=null;
try {
ret=factory.createServerSocket(service_name);
Util.bind(ret, bind_addr, start_port, start_port+1000, 50);
return ret;
}
catch(Exception e) {
return null;
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Finds first available port starting at start_port and returns server
* socket. Will not bind to port >end_port. Sets srv_port
*/
public static ServerSocket createServerSocketAndBind(SocketFactory factory,String service_name,InetAddress bind_addr,
int start_port,int end_port) throws Exception {
ServerSocket ret=factory.createServerSocket(service_name);
bind(ret, bind_addr, start_port, end_port);
return ret;
}
代码示例来源:origin: wildfly/wildfly
/**
* Creates a socket to {@code dest}, and assigns it to ping_sock. Also assigns ping_input
*/
protected boolean setupPingSocket(IpAddress dest) {
lock.lock();
try {
SocketAddress destAddr=new InetSocketAddress(dest.getIpAddress(), dest.getPort());
ping_sock=getSocketFactory().createSocket("jgroups.fd.ping_sock");
Util.bind(ping_sock, bind_addr, client_bind_port, client_bind_port+port_range);
ping_sock.setSoLinger(true, 1);
ping_sock.setKeepAlive(keep_alive);
Util.connect(ping_sock, destAddr, sock_conn_timeout);
ping_input=ping_sock.getInputStream();
return true;
}
catch(Throwable ex) {
if(!shuttin_down)
log.debug("%s: failed connecting to %s: %s",
local_addr, ping_dest != null? ping_dest : dest, ex.getMessage());
return false;
}
finally {
lock.unlock();
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static void bind(ServerSocket srv_sock, InetAddress bind_addr,
int start_port, int end_port) throws Exception {
bind(srv_sock, bind_addr, start_port, end_port, 50);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static void bind(final ServerSocketChannel ch, InetAddress bind_addr, int start_port, int end_port) throws Exception {
bind(ch, bind_addr, start_port, end_port, 50);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static ServerSocketChannel createServerSocketChannelAndBind(InetAddress bind_addr,
int start_port, int end_port) throws Exception {
ServerSocketChannel channel=ServerSocketChannel.open();
bind(channel, bind_addr, start_port, end_port);
return channel;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
protected static int getNextTCPPort(InetAddress bind_addr, int start_port) throws Exception {
try(ServerSocket sock=new ServerSocket()) {
sock.setReuseAddress(false);
Util.bind(sock, bind_addr, start_port, start_port+100);
return sock.getLocalPort();
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static ServerSocket createServerSocket(SocketFactory factory, String service_name, InetAddress bind_addr, int start_port) {
ServerSocket ret=null;
try {
ret=factory.createServerSocket(service_name);
Util.bind(ret, bind_addr, start_port, start_port+1000, 50);
return ret;
}
catch(Exception e) {
return null;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Finds first available port starting at start_port and returns server
* socket. Will not bind to port >end_port. Sets srv_port
*/
public static ServerSocket createServerSocketAndBind(SocketFactory factory,String service_name,InetAddress bind_addr,
int start_port,int end_port) throws Exception {
ServerSocket ret=factory.createServerSocket(service_name);
bind(ret, bind_addr, start_port, end_port);
return ret;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Creates a socket to {@code dest}, and assigns it to ping_sock. Also assigns ping_input
*/
protected boolean setupPingSocket(IpAddress dest) {
lock.lock();
try {
SocketAddress destAddr=new InetSocketAddress(dest.getIpAddress(), dest.getPort());
ping_sock=getSocketFactory().createSocket("jgroups.fd.ping_sock");
Util.bind(ping_sock, bind_addr, client_bind_port, client_bind_port+port_range);
ping_sock.setSoLinger(true, 1);
ping_sock.setKeepAlive(keep_alive);
Util.connect(ping_sock, destAddr, sock_conn_timeout);
ping_input=ping_sock.getInputStream();
return true;
}
catch(Throwable ex) {
if(!shuttin_down)
log.debug("%s: failed connecting to %s: %s",
local_addr, ping_dest != null? ping_dest : dest, ex.getMessage());
return false;
}
finally {
lock.unlock();
}
}
内容来源于网络,如有侵权,请联系作者删除!