Search in sources :

Example 1 with ConcurrentList

use of j.util.ConcurrentList in project JFramework by gugumall.

the class Online method removeMessageOutFirst.

public void removeMessageOutFirst(String sellerId) {
    ConcurrentList temp = (ConcurrentList) messagesWithSellerOut.get(sellerId);
    if (temp == null)
        temp = new ConcurrentList();
    if (!temp.isEmpty()) {
        temp.remove(0);
    }
    messagesWithSellerOut.put(sellerId, temp);
}
Also used : ConcurrentList(j.util.ConcurrentList)

Example 2 with ConcurrentList

use of j.util.ConcurrentList in project JFramework by gugumall.

the class Online method addMessageOut.

public void addMessageOut(Serializable msg, String sellerId) {
    ConcurrentList temp = (ConcurrentList) messagesWithSellerOut.get(sellerId);
    if (temp == null)
        temp = new ConcurrentList();
    temp.add(msg);
    messagesWithSellerOut.put(sellerId, temp);
}
Also used : ConcurrentList(j.util.ConcurrentList)

Example 3 with ConcurrentList

use of j.util.ConcurrentList in project JFramework by gugumall.

the class OnlinesCluster method getActiveUsers.

/**
 * @param rpp
 * @param pn
 * @return
 */
public static List getActiveUsers(int rpp, int pn) {
    JCacheParams params = new JCacheParams();
    params.recordsPerPage = rpp;
    params.pageNum = pn;
    try {
        return onlines.values(params);
    } catch (Exception e) {
        log.log(e, Logger.LEVEL_ERROR);
        return new ConcurrentList();
    }
}
Also used : JCacheParams(j.cache.JCacheParams) ConcurrentList(j.util.ConcurrentList) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 4 with ConcurrentList

use of j.util.ConcurrentList in project JFramework by gugumall.

the class SSOServer method login.

/**
 * @param client
 * @param loginStatus
 * @param notifyAll
 */
private static void login(Client client, LoginStatus loginStatus) {
    // 当前操作的SSO Client直接发送登录信息
    SSONotifier.getNotifier(client).login(client, loginStatus.getGlobalSessionId(), loginStatus.getUserId(), loginStatus.getUserIp());
    // 其它SSO Client通过通知线程发送登录信息
    ConcurrentList ssoClients = SSOConfig.getSsoClients();
    for (int i = 0; i < ssoClients.size(); i++) {
        Client c = (Client) ssoClients.get(i);
        // 当前操作的SSO Client直接发送登录信息
        if (c.getId().equals(client.getId()))
            continue;
        SSONotifier.addTask(c, loginStatus.getGlobalSessionId(), loginStatus.getUserId(), loginStatus.getUserIp(), SSONotifier.type_login);
    }
}
Also used : ConcurrentList(j.util.ConcurrentList)

Example 5 with ConcurrentList

use of j.util.ConcurrentList in project JFramework by gugumall.

the class SSOServer method logout.

/**
 * 注销sso server端信息并通知sso client端注销
 * @param client
 * @param loginStatus
 * @throws Exception
 */
private static void logout(Client client, LoginStatus loginStatus) throws Exception {
    HttpSession session = SSOContext.getSession(loginStatus.getSessionId());
    if (session != null) {
        // 移除session中保存的全局会话ID
        try {
            session.removeAttribute(Constants.SSO_GLOBAL_SESSION_ID);
        } catch (Exception e) {
            log.log(e.getMessage(), Logger.LEVEL_INFO);
        }
    }
    // 从缓存中清除
    users.remove(new JCacheParams(loginStatus.getUserId()));
    users.remove(new JCacheParams(loginStatus.getGlobalSessionId()));
    // 当前操作的SSO Client直接发送注销命令
    // SSONotifier.getNotifier(client).logout(client,
    // loginStatus.getGlobalSessionId(),
    // loginStatus.getUserId(),
    // loginStatus.getUserIp());
    // 其它SSO Client通过通知线程发送注销命令
    ConcurrentList ssoClients = SSOConfig.getSsoClients();
    for (int i = 0; i < ssoClients.size(); i++) {
        Client c = (Client) ssoClients.get(i);
        // if(c.getId().equals(client.getId())) continue;//当前操作的SSO Client直接发送注销命令
        SSONotifier.addTask(c, loginStatus.getGlobalSessionId(), loginStatus.getUserId(), loginStatus.getUserIp(), SSONotifier.type_logout);
    }
    // set to null
    loginStatus = null;
}
Also used : JCacheParams(j.cache.JCacheParams) HttpSession(javax.servlet.http.HttpSession) ConcurrentList(j.util.ConcurrentList)

Aggregations

ConcurrentList (j.util.ConcurrentList)22 ConcurrentMap (j.util.ConcurrentMap)5 JUtilList (j.util.JUtilList)4 List (java.util.List)4 Client (j.service.Client)3 JUtilString (j.util.JUtilString)3 JCacheParams (j.cache.JCacheParams)2 Serializable (java.io.Serializable)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 HttpClient (org.apache.http.client.HttpClient)2 JHttpContext (j.http.JHttpContext)1 Http (j.service.Http)1 Rmi (j.service.Rmi)1 JUtilSorter (j.util.JUtilSorter)1 File (java.io.File)1 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 ServletException (javax.servlet.ServletException)1 HttpSession (javax.servlet.http.HttpSession)1