public class MuxServerSocketChannel extends DelegatingServerSocketChannel<MuxingServerSocketChannel>
ServerSocketChannelwhich is capable of sharing its listening endpoint with multiple others like it.
|Modifier and Type||Field and Description|
The (ordered) list (i.e.
The Object which synchronizes the access to the state of this MuxServerSocketChannel such as
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Weeds out abandoned
Determines whether the
Allows extenders to optionally configure (e.g.
Opens and binds a new
getFD, getFDVal, kill, translateAndSetInterestOps, translateAndSetReadyOps, translateAndUpdateReadyOps
bind, getLocalAddress, getOption, implAccept, implCloseSelectableChannel, isBound, setOption, socket, supportedOptions
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
begin, close, end, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final Queue<Timestamped<SocketChannel>> acceptQ
protected final DatagramPacketFilter filter
SocketChannels accepted by the associated
protected MuxServerSocketChannel(MuxingServerSocketChannel delegate, DatagramPacketFilter filter)
MuxServerSocketChannelinstance which is to demultiplex
SocketChannels accepted by a specific
MuxingServerSocketChannelusing a specific
DatagramPacketFilter. The new instance shares the listening endpoint of
delegatewith any other associated
MuxingServerSocketChannelwhich is actually open and bound to a listening endpoint and accepts
SocketChannels to be filtered by associated
DatagramPacketFilterwhich is to demultiplex
SocketChannels accepted by
public static MuxServerSocketChannel openAndBind(Map<String,Object> properties, SocketAddress endpoint, int backlog, DatagramPacketFilter filter) throws IOException
MuxServerSocketChannelinstance. If there are other (existing)
MuxServerSocketChannelopen and bound on the specified listening
endpoint, the new instance will share it with them.
Mapof the values to be assigned to properties of the underlying
ServerSocketChannelwhich is to actually listen on the specified
endpoint. If the new instance is not the first to open and bind the specified
propertiesand their respective values may not be used.
endpoint- the IP and port the new instance is to bind to
backlog- the requested maximum number of pending incoming connections to be queued. If the new instance is not the first to open and bind the specified
endpoint, the value may not be used.
DatagramPacketFilterto demultiplex (i.e. recognize) the content meant for the new instance
MuxServerSocketChannelinstance open and bound on the specified listening
IOException- if an I/O error occurs
public SocketChannel accept() throws IOException
void closeAbandonedSocketChannels(long now)
acceptQi.e. which were classified/filtered into this
MuxServerSocketChannelbut were not accepted (out of it) for a long time.
now- the (system) time in milliseconds at which the method is invoked
protected boolean filterAccept(DatagramPacket p, SocketChannel channel)
filterof this instance accepts a specific
SocketChannelfrom which a specific
DatagramPackethas been read and, if it does, queues the
channelto be accepted through this instance.
DatagramPacketwhich has been read from
channeland which is to be analyzed by the
filterof this instance
phas been read and which is to be queued for acceptance through this instance if the
filterof this instance accepts
channelwas queued for acceptance through this instance; otherwise,
protected void implConfigureBlocking(boolean block) throws IOException
BaseDelegatingServerSocketChannel.delegate. Adjusts the blocking mode of
protected MuxServerSocket implSocket(ServerSocket socket) throws IOException
BaseDelegatingServerSocketChannel.delegateand before it is returned by
BaseDelegatingServerSocketChannel.socket(). Associates a
Copyright © 2018. All rights reserved.