java.net.ServerSocket.implAccept()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(178)

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

ServerSocket.implAccept介绍

[英]Invokes the server socket implementation to accept a connection on the given socket aSocket.
[中]调用服务器套接字实现以接受给定套接字aSocket上的连接。

代码示例

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

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

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

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: stackoverflow.com

"Monitor Ctrl-Break" daemon prio=6 tid=0x0000000006b98000 nid=0x1d70 runnable [0x00000000074df000]
  java.lang.Thread.State: RUNNABLE
  at java.net.PlainSocketImpl.socketAccept(Native Method)
  at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
  - locked <0x00000007d5d53148> (a java.net.SocksSocketImpl)
  at java.net.ServerSocket.implAccept(ServerSocket.java:462)
  at java.net.ServerSocket.accept(ServerSocket.java:430)
  at com.intellij.rt.execution.application.AppMain$1.run(AppMain.java:82)
  at java.lang.Thread.run(Thread.java:662)

  Locked ownable synchronizers:
  - None

...

代码示例来源:origin: org.apache.qpid/qpid-broker-plugins-management-jmx

@Override
  public Socket accept() throws IOException
  {
    Socket s = new NoLocalAddressSocket();
    super.implAccept(s);
    return s;
  }
}

代码示例来源:origin: stackoverflow.com

at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
- locked <7b20d3f08> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:462)
at java.net.ServerSocket.accept(ServerSocket.java:430)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)

代码示例来源:origin: stackoverflow.com

public class AuditableClientServerSocket extends ServerSocket {

  // Constructors removed for brevity. Add them back here

  @Override
  public Socket accept() throws IOException {
   if (isClosed())
     throw new SocketException("Socket is closed");
   if (!isBound())
     throw new SocketException("Socket is not bound yet");
   final Socket s = new AuditableClientSocket((SocketImpl) null);
   implAccept(s);
   return s;
  }
}

代码示例来源:origin: stackoverflow.com

public class ServerClientSocket extends ServerSocket {
 public ClientSocket accept() throws IOException {
 if (isClosed())
  throw new SocketException("Socket is closed");
 if (!isBound())
  throw new SocketException("Socket is not bound yet");
 ClientSocket s = new ClientSocket((SocketImpl) null);
 implAccept(s);
 return s;
 }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Waits for an incoming request and blocks until the connection is opened.
 * This method returns a socket object representing the just opened
 * connection.
 *
 * @return the connection representing socket.
 * @throws IOException
 *             if an error occurs while accepting a new connection.
 */
public Socket accept() throws IOException {
  checkOpen();
  if (!isBound()) {
    throw new SocketException("Socket is not bound");
  }
  Socket aSocket = new Socket();
  try {
    implAccept(aSocket);
  } catch (IOException e) {
    aSocket.close();
    throw e;
  }
  return aSocket;
}

代码示例来源:origin: MobiVM/robovm

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: ibinti/bugvm

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: com.bugvm/bugvm-rt

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: com.gluonhq/robovm-rt

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: FlexoVM/flexovm

public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  Socket clientSocket = clientSocketChannel.socket();
  boolean connectOK = false;
  try {
    synchronized (this) {
      super.implAccept(clientSocket);
      clientSocketChannel.setConnected();
      clientSocketChannel.setBound(true);
      clientSocketChannel.finishAccept();
    }
    connectOK = true;
  } finally {
    if (!connectOK) {
      clientSocket.close();
    }
  }
  return clientSocket;
}

代码示例来源:origin: stackoverflow.com

implAccept(s);
return s;

相关文章