This method initiates an asynchronous operation to accept a connection made to this channel's socket. The {@code handler} parameter isa completion handler that is invoked when a connection is accepted (or the operation fails). The result passed to the completion handler is the {@link AsynchronousSocketChannel} to the new connection.
When a new connection is accepted then the resulting {@code AsynchronousSocketChannel} will be bound to the same {@link AsynchronousChannelGroup} as this channel. If the group is {@link AsynchronousChannelGroup#isShutdown shutdown} and a connection is accepted,then the connection is closed, and the operation completes with an {@code IOException} and cause {@link ShutdownChannelGroupException}.
To allow for concurrent handling of new connections, the completion handler is not invoked directly by the initiating thread when a new connection is accepted immediately (see Threading).
If a security manager has been installed then it verifies that the address and port number of the connection's remote endpoint are permitted by the security manager's {@link SecurityManager#checkAccept checkAccept}method. The permission check is performed with privileges that are restricted by the calling context of this method. If the permission check fails then the connection is closed and the operation completes with a {@link SecurityException}. @param < A> The type of the attachment @param attachment The object to attach to the I/O operation; can be {@code null} @param handler The handler for consuming the result @throws AcceptPendingException If an accept operation is already in progress on this channel @throws NotYetBoundException If this channel's socket has not yet been bound @throws ShutdownChannelGroupException If the channel group has terminated
|
|
|
|
|
|
|
|
|
|
|
|
|
|