use of org.jivesoftware.openfire.session.LocalConnectionMultiplexerSession in project Openfire by igniterealtime.
the class LocalSessionManager method stop.
public void stop() {
try {
// Send the close stream header to all connected connections
Set<LocalSession> sessions = new HashSet<>();
sessions.addAll(preAuthenticatedSessions.values());
sessions.addAll(componentsSessions);
for (LocalIncomingServerSession incomingSession : incomingServerSessions.values()) {
sessions.add(incomingSession);
}
for (LocalConnectionMultiplexerSession multiplexer : connnectionManagerSessions.values()) {
sessions.add(multiplexer);
}
for (LocalSession session : sessions) {
try {
// Notify connected client that the server is being shut down
session.getConnection().systemShutdown();
} catch (Throwable t) {
// Ignore.
}
}
} catch (Exception e) {
// Ignore.
}
}
use of org.jivesoftware.openfire.session.LocalConnectionMultiplexerSession in project Openfire by igniterealtime.
the class SessionManager method createMultiplexerSession.
/**
* Creates a new <tt>ConnectionMultiplexerSession</tt>.
*
* @param conn the connection to create the session from.
* @param address the JID (may include a resource) of the connection manager's session.
* @return a newly created session.
*/
public LocalConnectionMultiplexerSession createMultiplexerSession(Connection conn, JID address) {
if (serverName == null) {
throw new IllegalStateException("Server not initialized");
}
StreamID id = nextStreamID();
LocalConnectionMultiplexerSession session = new LocalConnectionMultiplexerSession(serverName, conn, id);
conn.init(session);
// Register to receive close notification on this session so we can
// figure out when users that were using this connection manager may become unavailable
conn.registerCloseListener(multiplexerSessionListener, session);
// Add to connection multiplexer session.
boolean firstConnection = getConnectionMultiplexerSessions(address.getDomain()).isEmpty();
localSessionManager.getConnnectionManagerSessions().put(address.toString(), session);
// Keep track of the cluster node hosting the new CM connection
multiplexerSessionsCache.put(address.toString(), server.getNodeID().toByteArray());
if (firstConnection) {
// Notify ConnectionMultiplexerManager that a new connection manager
// is available
ConnectionMultiplexerManager.getInstance().multiplexerAvailable(address.getDomain());
}
return session;
}
Aggregations