当前位置: 首页>>代码示例>>Java>>正文


Java Connection.init方法代码示例

本文整理汇总了Java中org.androidpn.server.xmpp.net.Connection.init方法的典型用法代码示例。如果您正苦于以下问题:Java Connection.init方法的具体用法?Java Connection.init怎么用?Java Connection.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.androidpn.server.xmpp.net.Connection的用法示例。


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

示例1: createClientSession

import org.androidpn.server.xmpp.net.Connection; //导入方法依赖的package包/类
/**
 * 根据连接创建一个新的客户端会话并返回
 * 
 * @param conn
 * @return
 */
public ClientSession createClientSession(Connection conn) {
	if (serverName == null) {
		throw new IllegalStateException("服务未初始化");
	}

	Random random = new Random();
	String streamId = Integer.toHexString(random.nextInt());

	ClientSession session = new ClientSession(serverName, conn, streamId);
	conn.init(session);
	conn.registerCloseListener(clientSessionListener);

	// 添加到预认证会话集中
	preAuthSessions.put(session.getAddress().getResource(), session);

	// 用户会话计数器执行自增
	connectionsCounter.incrementAndGet();

	log.debug("一个客户端会话创建完成.");
	return session;
}
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:28,代码来源:SessionManager.java

示例2: createClientSession

import org.androidpn.server.xmpp.net.Connection; //导入方法依赖的package包/类
/**
 * Creates a new ClientSession and returns it.
 *  
 * @param conn the connection
 * @return a newly created session
 */
public ClientSession createClientSession(Connection conn) {
    if (serverName == null) {
        throw new IllegalStateException("Server not initialized");
    }

    Random random = new Random();
    String streamId = Integer.toHexString(random.nextInt());

    ClientSession session = new ClientSession(serverName, conn, streamId);
    conn.init(session);
    conn.registerCloseListener(clientSessionListener);

    // Add to pre-authenticated sessions
    preAuthSessions.put(session.getAddress().getResource(), session);

    // Increment the counter of user sessions
    connectionsCounter.incrementAndGet();

    log.debug("ClientSession created.");
    return session;
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:28,代码来源:SessionManager.java

示例3: createClientSession

import org.androidpn.server.xmpp.net.Connection; //导入方法依赖的package包/类
public ClientSession createClientSession(Connection conn, String streamId) {
    if (serverName == null) {
        throw new IllegalStateException("Server not initialized");
    }
    ClientSession session = new ClientSession(serverName, conn, streamId);
    conn.init(session);
    // Register to receive close notification on this session
    conn.registerCloseListener(clientSessionListener, session);
    // Add to pre-authenticated sessions
    preAuthSessions.put(session.getAddress().getResource(), session);
    // Increment the counter of user sessions
    connectionsCounter.incrementAndGet();

    log.debug("ClientSession created.");
    return session;
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:17,代码来源:SessionManager.java

示例4: createClientSession

import org.androidpn.server.xmpp.net.Connection; //导入方法依赖的package包/类
public ClientSession createClientSession(Connection conn, String streamId) {
    if (serverName == null) {
        throw new IllegalStateException("Server not initialized");
    }
    ClientSession session = new ClientSession(serverName, conn, streamId);
    conn.init(session);
    // Register to receive close notification on this session
    conn.registerCloseListener(clientSessionListener, session);
    // Add to pre-authenticated sessions
    preAuthSessions.put(session.getAddress().getResource(), session);
    // Increment the counter of user sessions
    connectionsCounter.incrementAndGet();
    return session;
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:15,代码来源:SessionManager.java

示例5: createClientSession

import org.androidpn.server.xmpp.net.Connection; //导入方法依赖的package包/类
public ClientSession createClientSession(Connection conn, String streamId) {
    if (serverName == null) {
        throw new IllegalStateException("Server not initialized");
    }
    ClientSession session = new ClientSession(serverName, conn, streamId);
    conn.init(session);

    // Add to pre-authenticated sessions
    preAuthSessions.put(session.getAddress().getResource(), session);

    // Increment the counter of user sessions
    connectionsCounter.incrementAndGet();

    return session;
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:16,代码来源:SessionManager.java


注:本文中的org.androidpn.server.xmpp.net.Connection.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。