public final class ConcurrentSessionsBySourceLimiter extends Object implements SessionHandler
SessionHandler to track and limit connection counts by remote addresses.SessionHandler.SessionAcceptance| Constructor and Description |
|---|
ConcurrentSessionsBySourceLimiter(int maxConnectionsPerSource)
Create a new
ConcurrentSessionsBySourceLimiter with default reject message:
"421 Too many connections, try again later". |
ConcurrentSessionsBySourceLimiter(int maxConnectionsPerSource,
int code,
String message)
Create a new
ConcurrentSessionsBySourceLimiter with custom reject message |
| Modifier and Type | Method and Description |
|---|---|
SessionHandler.SessionAcceptance |
accept(Session session)
This method is invoked on a session creation, before sending the SMTP greeting and can react rejecting
the session.
|
void |
onSessionEnd(Session session)
This method is invoked on session close.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitacceptAll, limitConcurrentSessionsBySourcepublic ConcurrentSessionsBySourceLimiter(int maxConnectionsPerSource)
ConcurrentSessionsBySourceLimiter with default reject message:
"421 Too many connections, try again later".maxConnectionsPerSource - maximum number of concurrent connection per remote source ippublic ConcurrentSessionsBySourceLimiter(int maxConnectionsPerSource,
int code,
String message)
ConcurrentSessionsBySourceLimiter with custom reject messagemaxConnectionsPerSource - maximum number of concurrent connection per remote source ipcode - SMTP codemessage - SMTP messagepublic SessionHandler.SessionAcceptance accept(Session session)
SessionHandler
Rejected session will be closed and no method SessionHandler.onSessionEnd(Session) will be invoked.
accept in interface SessionHandlersession - newly created session (should never be null)public void onSessionEnd(Session session)
SessionHandleronSessionEnd in interface SessionHandlersession - closing sessionCopyright © 2006–2024. All rights reserved.