|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConnectionAcceptor
The ConnectionAcceptor is used by the NIOServerSocket to determine if a connection should be accepted or refused.
This can be used to implement black-listing of certain IP-ranges or to limit the number of simultaneous connection. However, in most cases it is enough to use the ConnectorAcceptor.ALLOW which accepts all incoming connections.
Note that a NIOServerSocket defaults to the ConnectorAcceptor.ALLOW acceptor when it is created.
Field Summary | |
---|---|
static ConnectionAcceptor |
ALLOW
A connection acceptor that accepts all connections. |
static ConnectionAcceptor |
DENY
A connection acceptor that refuses all connections. |
Method Summary | |
---|---|
boolean |
acceptConnection(java.net.InetSocketAddress inetSocketAddress)
Return true if the connection should be accepted, false otherwise. |
Field Detail |
---|
static final ConnectionAcceptor DENY
static final ConnectionAcceptor ALLOW
Method Detail |
---|
boolean acceptConnection(java.net.InetSocketAddress inetSocketAddress)
Note: This callback is run on the NIOService thread. This means it will block all other reads, writes and accepts on the service while it executes. For this reason it is recommended that this method should return fairly quickly (i.e. don't make reverse ip lookups or similar - potentially very slow - calls).
inetSocketAddress
- the adress the connection came from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |