public class BaseDelegatingServerSocketChannel<T extends ServerSocketChannel> extends ServerSocketChannel
ServerSocketChannel
which delegates (its method calls)
to another ServerSocketChannel
. In other words, the former wraps the
latter.Modifier and Type | Field and Description |
---|---|
protected T |
delegate
The
ServerSocketChannel this instance delegates (its method
calls) to. |
private ServerSocket |
socket
The
ServerSocket to be reported by this instance. |
private Object |
socketSyncRoot
The Object which synchronizes the access to
socket . |
Constructor and Description |
---|
BaseDelegatingServerSocketChannel(T delegate)
Initializes a new
BaseDelegatingServerSocketChannel instance
which is to delegate (its method calls) to a specific
ServerSocketChannel . |
Modifier and Type | Method and Description |
---|---|
SocketChannel |
accept()
Forwards to
delegate . |
ServerSocketChannel |
bind(SocketAddress local,
int backlog)
Forwards to
delegate and returns this . |
SocketAddress |
getLocalAddress()
Forwards to
delegate . |
<U> U |
getOption(SocketOption<U> name)
Forwards to
delegate . |
protected SocketChannel |
implAccept(SocketChannel accepted)
Allows extenders to optionally configure (e.g.
|
protected void |
implCloseSelectableChannel()
Forwards to
delegate . |
protected void |
implConfigureBlocking(boolean block)
Forwards to
delegate . |
protected ServerSocket |
implSocket(ServerSocket socket)
Allows extenders to optionally configure (e.g.
|
boolean |
isBound()
Determines whether this
BaseDelegatingServerSocketChannel is
bound. |
<U> ServerSocketChannel |
setOption(SocketOption<U> name,
U value)
Forwards to
delegate and returns this . |
ServerSocket |
socket()
Allows wrapping the
socket of delegate . |
Set<SocketOption<?>> |
supportedOptions()
Forwards to
delegate . |
bind, open, validOps
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
register
begin, close, end, isOpen
protected final T extends ServerSocketChannel delegate
ServerSocketChannel
this instance delegates (its method
calls) to.private ServerSocket socket
ServerSocket
to be reported by this instance.public BaseDelegatingServerSocketChannel(T delegate)
BaseDelegatingServerSocketChannel
instance
which is to delegate (its method calls) to a specific
ServerSocketChannel
.delegate
- the ServerSocketChannel
the new instance is to
delegate (its method calls) topublic SocketChannel accept() throws IOException
delegate
.accept
in class ServerSocketChannel
IOException
public ServerSocketChannel bind(SocketAddress local, int backlog) throws IOException
delegate
and returns this
.bind
in class ServerSocketChannel
IOException
public SocketAddress getLocalAddress() throws IOException
delegate
.getLocalAddress
in interface NetworkChannel
getLocalAddress
in class ServerSocketChannel
IOException
public <U> U getOption(SocketOption<U> name) throws IOException
delegate
.IOException
protected SocketChannel implAccept(SocketChannel accepted) throws IOException
delegate
and
before it is returned by accept()
.accepted
- the SocketChannel accepted by delegateaccept()
(in place of accepted)IOException
- if an I/O error occursprotected void implCloseSelectableChannel() throws IOException
delegate
.implCloseSelectableChannel
in class AbstractSelectableChannel
IOException
protected void implConfigureBlocking(boolean block) throws IOException
delegate
.implConfigureBlocking
in class AbstractSelectableChannel
IOException
protected ServerSocket implSocket(ServerSocket socket) throws IOException
ServerSocket
of delegate
and before it is returned by
socket()
.socket
- the ServerSocket
of delegate
ServerSocket
to be returned by socket()
(in
place of socket
)IOException
- if an I/O error occurspublic boolean isBound()
BaseDelegatingServerSocketChannel
is
bound.true
if this instancei bound; otherwise, false
public <U> ServerSocketChannel setOption(SocketOption<U> name, U value) throws IOException
delegate
and returns this
.setOption
in interface NetworkChannel
setOption
in class ServerSocketChannel
IOException
public ServerSocket socket()
socket
of delegate
.socket
in class ServerSocketChannel
public Set<SocketOption<?>> supportedOptions()
delegate
.Copyright © 2018. All rights reserved.