public abstract class SessionConnector extends Object implements Connector
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_QUEUE_CAPACITY |
protected org.slf4j.Logger |
log |
protected Executor |
longLivedExecutor |
protected PropertyChangeSupport |
propertyChangeSupport |
static String |
QF_SESSION |
static String |
QFJ_RESET_IO_CONNECTOR |
static String |
SESSIONS_PROPERTY |
protected Executor |
shortLivedExecutor |
Constructor and Description |
---|
SessionConnector(SessionSettings settings,
SessionFactory sessionFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addDynamicSession(Session inSession) |
void |
addPropertyChangeListener(PropertyChangeListener listener) |
protected void |
clearConnectorSessions()
Will remove all Sessions from the SessionConnector's Session map.
|
static void |
closeManagedSessionsAndDispose(org.apache.mina.core.service.IoService ioService,
boolean awaitTermination,
org.slf4j.Logger logger)
Closes all managed sessions of an Initiator/Acceptor.
|
protected Session |
createSession(SessionID sessionID) |
protected int |
getIntSetting(String key) |
protected org.apache.mina.core.filterchain.IoFilterChainBuilder |
getIoFilterChainBuilder() |
List<Session> |
getManagedSessions()
Get the list of session managed by this connector.
|
protected ScheduledExecutorService |
getScheduledExecutorService() |
protected Map<SessionID,Session> |
getSessionMap()
This is for subclasses to directly access the session map.
|
ArrayList<SessionID> |
getSessions()
Return the list of session identifiers of sessions managed
by this connector.
|
SessionSettings |
getSettings() |
protected boolean |
isContinueInitOnError() |
boolean |
isLoggedOn()
Check if we have at least one session and that all the sessions are logged on
|
protected void |
logError(SessionID sessionID,
org.apache.mina.core.session.IoSession protocolSession,
String message,
Throwable t) |
protected void |
logoutAllSessions(boolean forceDisconnect) |
void |
removeDynamicSession(SessionID inSessionID) |
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
setExecutorFactory(ExecutorFactory executorFactory)
Supplies the Executors to be used for all message processing and timer activities.
|
void |
setIoFilterChainBuilder(org.apache.mina.core.filterchain.IoFilterChainBuilder ioFilterChainBuilder)
Allows a custom IOFilterChainBuilder to be added to the session connector.
|
protected void |
setSessions(Map<SessionID,Session> sessions) |
protected void |
startSessionTimer() |
protected void |
stopSessionTimer() |
protected void |
waitForLogout() |
protected static final int DEFAULT_QUEUE_CAPACITY
public static final String SESSIONS_PROPERTY
public static final String QF_SESSION
public static final String QFJ_RESET_IO_CONNECTOR
protected final org.slf4j.Logger log
protected final PropertyChangeSupport propertyChangeSupport
protected Executor longLivedExecutor
protected Executor shortLivedExecutor
public SessionConnector(SessionSettings settings, SessionFactory sessionFactory) throws ConfigError
ConfigError
public void setExecutorFactory(ExecutorFactory executorFactory)
Supplies the Executors to be used for all message processing and timer activities. This will override the default behavior which uses internally created Threads. This enables scenarios such as a ResourceAdapter to supply the WorkManager (when adapted to the Executor API) so that all Application call-backs occur on container managed threads.
If using external Executors, this method should be called immediately after the constructor. Once set, the Executors cannot be changed.
executorFactory
- See ExecutorFactory
for detailed requirements.public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
protected void clearConnectorSessions()
public List<Session> getManagedSessions()
Session
protected Map<SessionID,Session> getSessionMap()
public ArrayList<SessionID> getSessions()
getSessions
in interface Connector
public void addDynamicSession(Session inSession)
public void removeDynamicSession(SessionID inSessionID)
public SessionSettings getSettings()
protected Session createSession(SessionID sessionID) throws ConfigError
ConfigError
protected int getIntSetting(String key) throws ConfigError
ConfigError
public boolean isLoggedOn()
isLoggedOn
in interface Connector
protected void logoutAllSessions(boolean forceDisconnect)
protected void waitForLogout()
protected void logError(SessionID sessionID, org.apache.mina.core.session.IoSession protocolSession, String message, Throwable t)
protected void startSessionTimer()
protected void stopSessionTimer()
protected ScheduledExecutorService getScheduledExecutorService()
public void setIoFilterChainBuilder(org.apache.mina.core.filterchain.IoFilterChainBuilder ioFilterChainBuilder)
ioFilterChainBuilder
- IoFilterChainBuilder
protected org.apache.mina.core.filterchain.IoFilterChainBuilder getIoFilterChainBuilder()
public static void closeManagedSessionsAndDispose(org.apache.mina.core.service.IoService ioService, boolean awaitTermination, org.slf4j.Logger logger)
ioService
- Acceptor or Initiator implementationawaitTermination
- whether to wait for underlying ExecutorService to terminatelogger
- used for logging WARNING when IoSession could not be closedprotected boolean isContinueInitOnError()
Copyright © 2021. All rights reserved.