• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ConnectionMultiplexerManager类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager的典型用法代码示例。如果您正苦于以下问题:Java ConnectionMultiplexerManager类的具体用法?Java ConnectionMultiplexerManager怎么用?Java ConnectionMultiplexerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ConnectionMultiplexerManager类属于org.jivesoftware.openfire.multiplex包,在下文中一共展示了ConnectionMultiplexerManager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createMultiplexerSession

点赞 3

import org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager; //导入依赖的package包/类
/**
 * 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;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:31,
代码来源:SessionManager.java

示例2: authenticate

点赞 3

import org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager; //导入依赖的package包/类
/**
 * Authenticates the connection manager. Shared secret is validated with the one provided
 * by the connection manager. If everything went fine then the session will have a status
 * of "authenticated" and the connection manager will receive the client configuration
 * options.
 *
 * @param digest the digest provided by the connection manager with the handshake stanza.
 * @return true if the connection manager was sucessfully authenticated.
 */
public boolean authenticate(String digest) {
    // Perform authentication. Wait for the handshake (with the secret key)
    String anticipatedDigest = AuthFactory.createDigest(getStreamID().getID(),
            ConnectionMultiplexerManager.getDefaultSecret());
    // Check that the provided handshake (secret key + sessionID) is correct
    if (!anticipatedDigest.equalsIgnoreCase(digest)) {
        Log.debug("LocalConnectionMultiplexerSession: [ConMng] Incorrect handshake for connection manager with domain: " +
                getAddress().getDomain());
        //  The credentials supplied by the initiator are not valid (answer an error
        // and close the connection)
        conn.deliverRawText(new StreamError(StreamError.Condition.not_authorized).toXML());
        // Close the underlying connection
        conn.close();
        return false;
    }
    else {
        // Component has authenticated fine
        setStatus(STATUS_AUTHENTICATED);
        // Send empty handshake element to acknowledge success
        conn.deliverRawText("<handshake></handshake>");
        Log.debug("LocalConnectionMultiplexerSession: [ConMng] Connection manager was AUTHENTICATED with domain: " + getAddress());
        sendClientOptions();
        return true;
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:35,
代码来源:LocalConnectionMultiplexerSession.java

示例3: createMultiplexerSession

点赞 3

import org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager; //导入依赖的package包/类
/**
 * 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;
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:31,
代码来源:SessionManager.java

示例4: onConnectionClose

点赞 2

import org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager; //导入依赖的package包/类
/**
 * Handle a session that just closed.
 *
 * @param handback The session that just closed
 */
@Override
public void onConnectionClose(Object handback) {
    ConnectionMultiplexerSession session = (ConnectionMultiplexerSession)handback;
    // Remove all the hostnames that were registered for this server session
    String domain = session.getAddress().getDomain();
    localSessionManager.getConnnectionManagerSessions().remove(session.getAddress().toString());
    // Remove track of the cluster node hosting the CM connection
    multiplexerSessionsCache.remove(session.getAddress().toString());
    if (getConnectionMultiplexerSessions(domain).isEmpty()) {
        // Terminate ClientSessions originated from this connection manager
        // that are still active since the connection manager has gone down
        ConnectionMultiplexerManager.getInstance().multiplexerUnavailable(domain);
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:20,
代码来源:SessionManager.java

示例5: onConnectionClose

点赞 2

import org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager; //导入依赖的package包/类
/**
 * Handle a session that just closed.
 *
 * @param handback The session that just closed
 */
public void onConnectionClose(Object handback) {
    ConnectionMultiplexerSession session = (ConnectionMultiplexerSession)handback;
    // Remove all the hostnames that were registered for this server session
    String domain = session.getAddress().getDomain();
    localSessionManager.getConnnectionManagerSessions().remove(session.getAddress().toString());
    // Remove track of the cluster node hosting the CM connection
    multiplexerSessionsCache.remove(session.getAddress().toString());
    if (getConnectionMultiplexerSessions(domain).isEmpty()) {
        // Terminate ClientSessions originated from this connection manager
        // that are still active since the connection manager has gone down
        ConnectionMultiplexerManager.getInstance().multiplexerUnavailable(domain);
    }
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:19,
代码来源:SessionManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)