APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.ch

pack-priv abstract Class AsynchronousServerSocketChannelImpl

extends AsynchronousServerSocketChannel
implements Cancellable, Groupable
Class Inheritance
All Implemented Interfaces
sun.nio.ch.Groupable, sun.nio.ch.Cancellable
Known Direct Subclasses
sun.nio.ch.UnixAsynchronousServerSocketChannelImpl
Imports
java.nio.channels.*, java.net.SocketAddress, .SocketOption, .StandardSocketOptions, .InetSocketAddress, java.io.FileDescriptor, .IOException, java.util.Set, .HashSet, .Collections, java.util.concurrent.Future, java.util.concurrent.locks.ReadWriteLock, .ReentrantReadWriteLock, sun.net.ext.ExtendedSocketOptions

Base implementation of AsynchronousServerSocketChannel.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private volatile boolean
private volatile boolean
private final ReadWriteLock
protected final FileDescriptor
private boolean
protected volatile InetSocketAddress
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final Future<AsynchronousSocketChannel>
accept()

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.accept.

Accepts a connection.

public final <A> void
accept(A attachment, CompletionHandler<AsynchronousSocketChannel, ? super A> handler)

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.accept.

Accepts a connection.

pack-priv final void
begin()

Marks beginning of access to file descriptor/handle

public final AsynchronousServerSocketChannel
bind(SocketAddress local, int backlog)

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.bind.

Binds the channel's socket to a local address and configures the socket to listen for connections.

public final void
pack-priv final void
end()

Marks end of access to file descriptor/handle

public final SocketAddress
getLocalAddress()

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.getLocalAddress.

Implements java.nio.channels.NetworkChannel.getLocalAddress.

Returns the socket address that this channel's socket is bound to.

public final <T> T
getOption(SocketOption<T> name)

Implements java.nio.channels.NetworkChannel.getOption.

Returns the value of a socket option.

pack-priv abstract Future<AsynchronousSocketChannel>
implAccept(Object attachment, CompletionHandler<AsynchronousSocketChannel, Object> handler)

Invoked by accept to accept connection

pack-priv abstract void
implClose()

Invoked to close file descriptor/handle.

pack-priv final boolean
public final boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

public final void
onCancel(PendingFuture<?, ?> task)

Implements sun.nio.ch.Cancellable.onCancel.

Invoked to notify channel that cancel has been invoked while holding the Future's lock.

public final <T> AsynchronousServerSocketChannel
setOption(SocketOption<T> name, T value)

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.setOption.

Implements java.nio.channels.NetworkChannel.setOption.

Sets the value of a socket option.

public final Set<SocketOption<?>>
supportedOptions()

Implements java.nio.channels.NetworkChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.nio.channels.AsynchronousServerSocketChannel:
bindopenopenprovider

Field Detail

acceptKilledback to summary
private volatile boolean acceptKilled
closedback to summary
private volatile boolean closed
closeLockback to summary
private final ReadWriteLock closeLock
fdback to summary
protected final FileDescriptor fd
isReuseAddressback to summary
private boolean isReuseAddress
localAddressback to summary
protected volatile InetSocketAddress localAddress
stateLockback to summary
private final Object stateLock

Constructor Detail

AsynchronousServerSocketChannelImplback to summary
pack-priv AsynchronousServerSocketChannelImpl(AsynchronousChannelGroupImpl group)

Method Detail

acceptback to summary
public final Future<AsynchronousSocketChannel> accept()

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.accept.

Doc from java.nio.channels.AsynchronousServerSocketChannel.accept.

Accepts a connection.

This method initiates an asynchronous operation to accept a connection made to this channel's socket. The method behaves in exactly the same manner as the accept(Object, CompletionHandler) method except that instead of specifying a completion handler, this method returns a Future representing the pending result. The Future's get method returns the AsynchronousSocketChannel to the new connection on successful completion.

Annotations
@Override
acceptback to summary
public final <A> void accept(A attachment, CompletionHandler<AsynchronousSocketChannel, ? super A> handler)

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.accept.

Doc from java.nio.channels.AsynchronousServerSocketChannel.accept.

Accepts a connection.

This method initiates an asynchronous operation to accept a connection made to this channel's socket. The handler parameter is a completion handler that is invoked when a connection is accepted (or the operation fails). The result passed to the completion handler is the AsynchronousSocketChannel to the new connection.

When a new connection is accepted then the resulting AsynchronousSocketChannel will be bound to the same AsynchronousChannelGroup as this channel. If the group is shutdown and a connection is accepted, then the connection is closed, and the operation completes with an IOException and cause 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).

Annotations
@Override
@SuppressWarnings:unchecked
beginback to summary
pack-priv final void begin() throws IOException

Marks beginning of access to file descriptor/handle

bindback to summary
public final AsynchronousServerSocketChannel bind(SocketAddress local, int backlog) throws IOException

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.bind.

Doc from java.nio.channels.AsynchronousServerSocketChannel.bind.

Binds the channel's socket to a local address and configures the socket to listen for connections.

This method is used to establish an association between the socket and a local address. Once an association is established then the socket remains bound until the associated channel is closed.

The backlog parameter is the maximum number of pending connections on the socket. Its exact semantics are implementation specific. In particular, an implementation may impose a maximum length or may choose to ignore the parameter altogether. If the backlog parameter has the value 0, or a negative value, then an implementation specific default is used.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
closeback to summary
public final void close() throws IOException

Implements java.nio.channels.AsynchronousChannel.close, java.nio.channels.Channel.close.

Doc from java.nio.channels.AsynchronousChannel.close.

Closes this channel.

Any outstanding asynchronous operations upon this channel will complete with the exception AsynchronousCloseException. After a channel is closed, further attempts to initiate asynchronous I/O operations complete immediately with cause ClosedChannelException.

This method otherwise behaves exactly as specified by the Channel interface.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
endback to summary
pack-priv final void end()

Marks end of access to file descriptor/handle

getLocalAddressback to summary
public final SocketAddress getLocalAddress() throws IOException

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.getLocalAddress.

Implements java.nio.channels.NetworkChannel.getLocalAddress.

Doc from java.nio.channels.AsynchronousServerSocketChannel.getLocalAddress.

Returns the socket address that this channel's socket is bound to.

Where the channel is bound to an Internet Protocol socket address then the return value from this method is of type java.net.InetSocketAddress.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getOptionback to summary
public final <T> T getOption(SocketOption<T> name) throws IOException

Implements java.nio.channels.NetworkChannel.getOption.

Doc from java.nio.channels.NetworkChannel.getOption.

Returns the value of a socket option.

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
IOException:
If an I/O error occurs
implAcceptback to summary
pack-priv abstract Future<AsynchronousSocketChannel> implAccept(Object attachment, CompletionHandler<AsynchronousSocketChannel, Object> handler)

Invoked by accept to accept connection

implCloseback to summary
pack-priv abstract void implClose() throws IOException

Invoked to close file descriptor/handle.

isAcceptKilledback to summary
pack-priv final boolean isAcceptKilled()
isOpenback to summary
public final boolean isOpen()

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Annotations
@Override
onCancelback to summary
public final void onCancel(PendingFuture<?, ?> task)

Implements sun.nio.ch.Cancellable.onCancel.

Doc from sun.nio.ch.Cancellable.onCancel.

Invoked to notify channel that cancel has been invoked while holding the Future's lock.

Annotations
@Override
setOptionback to summary
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name, T value) throws IOException

Implements abstract java.nio.channels.AsynchronousServerSocketChannel.setOption.

Implements java.nio.channels.NetworkChannel.setOption.

Doc from java.nio.channels.NetworkChannel.setOption.

Sets the value of a socket option.

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.AsynchronousServerSocketChannel.setOption.

If an I/O error occurs

supportedOptionsback to summary
public final Set<SocketOption<?>> supportedOptions()

Implements java.nio.channels.NetworkChannel.supportedOptions.

Doc from java.nio.channels.NetworkChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

This method will continue to return the set of options even after the channel has been closed.

Annotations
@Override
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
sun.nio.ch back to summary

private Class AsynchronousServerSocketChannelImpl.DefaultOptionsHolder

extends Object
Class Inheritance
  • java.lang.Object
  • sun.nio.ch.AsynchronousServerSocketChannelImpl.DefaultOptionsHolder

Field Summary

Modifier and TypeField and Description
pack-priv static final Set<SocketOption<?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Set<SocketOption<?>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultOptionsback to summary
pack-priv static final Set<SocketOption<?>> defaultOptions

Constructor Detail

DefaultOptionsHolderback to summary
private DefaultOptionsHolder()

Method Detail

defaultOptionsback to summary
private static Set<SocketOption<?>> defaultOptions()