public class ConnectionThrottleFilter extends IoFilterAdapter
IoFilter
which blocks connections from connecting
at a rate faster than the specified interval.IoFilter.NextFilter
Constructor and Description |
---|
ConnectionThrottleFilter()
Default constructor.
|
ConnectionThrottleFilter(long allowedInterval)
Constructor that takes in a specified wait time.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isConnectionOk(IoSession session)
Method responsible for deciding if a connection is OK
to continue
|
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionCreated(IoSession) event. |
void |
setAllowedInterval(long allowedInterval)
Sets the interval between connections from a client.
|
destroy, event, exceptionCaught, filterClose, filterWrite, init, inputClosed, messageReceived, messageSent, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionIdle, sessionOpened, toString
public ConnectionThrottleFilter()
public ConnectionThrottleFilter(long allowedInterval)
allowedInterval
- The number of milliseconds a client is allowed to wait
before making another successful connectionpublic void setAllowedInterval(long allowedInterval)
allowedInterval
- The number of milliseconds a client is allowed to wait
before making another successful connectionprotected boolean isConnectionOk(IoSession session)
session
- The new session that will be verifiedpublic void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilterAdapter
IoHandler.sessionCreated(IoSession)
event.sessionCreated
in interface IoFilter
sessionCreated
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventCopyright © 2004–2021 Apache MINA Project. All rights reserved.