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

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

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

Util.bind介绍

暂无

代码示例

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

  1. public static void bind(ServerSocket srv_sock, InetAddress bind_addr,
  2. int start_port, int end_port) throws Exception {
  3. bind(srv_sock, bind_addr, start_port, end_port, 50);
  4. }

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

  1. public static void bind(final ServerSocketChannel ch, InetAddress bind_addr, int start_port, int end_port) throws Exception {
  2. bind(ch, bind_addr, start_port, end_port, 50);
  3. }

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

  1. public static ServerSocketChannel createServerSocketChannelAndBind(InetAddress bind_addr,
  2. int start_port, int end_port) throws Exception {
  3. ServerSocketChannel channel=ServerSocketChannel.open();
  4. bind(channel, bind_addr, start_port, end_port);
  5. return channel;
  6. }

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

  1. protected static int getNextTCPPort(InetAddress bind_addr, int start_port) throws Exception {
  2. try(ServerSocket sock=new ServerSocket()) {
  3. sock.setReuseAddress(false);
  4. Util.bind(sock, bind_addr, start_port, start_port+100);
  5. return sock.getLocalPort();
  6. }
  7. }

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

  1. public static ServerSocket createServerSocket(SocketFactory factory, String service_name, InetAddress bind_addr, int start_port) {
  2. ServerSocket ret=null;
  3. try {
  4. ret=factory.createServerSocket(service_name);
  5. Util.bind(ret, bind_addr, start_port, start_port+1000, 50);
  6. return ret;
  7. }
  8. catch(Exception e) {
  9. return null;
  10. }
  11. }

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

  1. /**
  2. * Finds first available port starting at start_port and returns server
  3. * socket. Will not bind to port >end_port. Sets srv_port
  4. */
  5. public static ServerSocket createServerSocketAndBind(SocketFactory factory,String service_name,InetAddress bind_addr,
  6. int start_port,int end_port) throws Exception {
  7. ServerSocket ret=factory.createServerSocket(service_name);
  8. bind(ret, bind_addr, start_port, end_port);
  9. return ret;
  10. }

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

  1. /**
  2. * Creates a socket to {@code dest}, and assigns it to ping_sock. Also assigns ping_input
  3. */
  4. protected boolean setupPingSocket(IpAddress dest) {
  5. lock.lock();
  6. try {
  7. SocketAddress destAddr=new InetSocketAddress(dest.getIpAddress(), dest.getPort());
  8. ping_sock=getSocketFactory().createSocket("jgroups.fd.ping_sock");
  9. Util.bind(ping_sock, bind_addr, client_bind_port, client_bind_port+port_range);
  10. ping_sock.setSoLinger(true, 1);
  11. ping_sock.setKeepAlive(keep_alive);
  12. Util.connect(ping_sock, destAddr, sock_conn_timeout);
  13. ping_input=ping_sock.getInputStream();
  14. return true;
  15. }
  16. catch(Throwable ex) {
  17. if(!shuttin_down)
  18. log.debug("%s: failed connecting to %s: %s",
  19. local_addr, ping_dest != null? ping_dest : dest, ex.getMessage());
  20. return false;
  21. }
  22. finally {
  23. lock.unlock();
  24. }
  25. }

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

  1. public static void bind(ServerSocket srv_sock, InetAddress bind_addr,
  2. int start_port, int end_port) throws Exception {
  3. bind(srv_sock, bind_addr, start_port, end_port, 50);
  4. }

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

  1. public static void bind(final ServerSocketChannel ch, InetAddress bind_addr, int start_port, int end_port) throws Exception {
  2. bind(ch, bind_addr, start_port, end_port, 50);
  3. }

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

  1. public static ServerSocketChannel createServerSocketChannelAndBind(InetAddress bind_addr,
  2. int start_port, int end_port) throws Exception {
  3. ServerSocketChannel channel=ServerSocketChannel.open();
  4. bind(channel, bind_addr, start_port, end_port);
  5. return channel;
  6. }

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

  1. protected static int getNextTCPPort(InetAddress bind_addr, int start_port) throws Exception {
  2. try(ServerSocket sock=new ServerSocket()) {
  3. sock.setReuseAddress(false);
  4. Util.bind(sock, bind_addr, start_port, start_port+100);
  5. return sock.getLocalPort();
  6. }
  7. }

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

  1. public static ServerSocket createServerSocket(SocketFactory factory, String service_name, InetAddress bind_addr, int start_port) {
  2. ServerSocket ret=null;
  3. try {
  4. ret=factory.createServerSocket(service_name);
  5. Util.bind(ret, bind_addr, start_port, start_port+1000, 50);
  6. return ret;
  7. }
  8. catch(Exception e) {
  9. return null;
  10. }
  11. }

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

  1. /**
  2. * Finds first available port starting at start_port and returns server
  3. * socket. Will not bind to port >end_port. Sets srv_port
  4. */
  5. public static ServerSocket createServerSocketAndBind(SocketFactory factory,String service_name,InetAddress bind_addr,
  6. int start_port,int end_port) throws Exception {
  7. ServerSocket ret=factory.createServerSocket(service_name);
  8. bind(ret, bind_addr, start_port, end_port);
  9. return ret;
  10. }

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

  1. /**
  2. * Creates a socket to {@code dest}, and assigns it to ping_sock. Also assigns ping_input
  3. */
  4. protected boolean setupPingSocket(IpAddress dest) {
  5. lock.lock();
  6. try {
  7. SocketAddress destAddr=new InetSocketAddress(dest.getIpAddress(), dest.getPort());
  8. ping_sock=getSocketFactory().createSocket("jgroups.fd.ping_sock");
  9. Util.bind(ping_sock, bind_addr, client_bind_port, client_bind_port+port_range);
  10. ping_sock.setSoLinger(true, 1);
  11. ping_sock.setKeepAlive(keep_alive);
  12. Util.connect(ping_sock, destAddr, sock_conn_timeout);
  13. ping_input=ping_sock.getInputStream();
  14. return true;
  15. }
  16. catch(Throwable ex) {
  17. if(!shuttin_down)
  18. log.debug("%s: failed connecting to %s: %s",
  19. local_addr, ping_dest != null? ping_dest : dest, ex.getMessage());
  20. return false;
  21. }
  22. finally {
  23. lock.unlock();
  24. }
  25. }

相关文章

Util类方法