Search in sources :

Example 1 with ThreadPoolStatus

use of com.alibaba.cobar.manager.dataobject.cobarnode.ThreadPoolStatus in project cobar by alibaba.

the class CobarNodeInstantPerfValueAjax method listThreadPool.

/**
     * ThreadPool Tab
     * 
     * @param params
     * @return
     */
private List<Map<String, Object>> listThreadPool(AjaxParams params) {
    CobarAdapterDAO perfAccesser = cobarAccesser.getAccesser(params.getCobarNodeId());
    if (!perfAccesser.checkConnection()) {
        return null;
    }
    List<ThreadPoolStatus> pools = perfAccesser.listThreadPoolStatus();
    List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
    for (ThreadPoolStatus t : pools) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("threadPoolName", t.getThreadPoolName());
        map.put("poolSize", t.getPoolSize());
        map.put("activeSize", t.getActiveSize());
        map.put("taskQueue", t.getTaskQueue());
        map.put("completedTask", FormatUtil.formatNumber(t.getCompletedTask()));
        map.put("totalTask", FormatUtil.formatNumber(t.getTotalTask()));
        returnList.add(map);
    }
    return returnList;
}
Also used : CobarAdapterDAO(com.alibaba.cobar.manager.dao.CobarAdapterDAO) HashMap(java.util.HashMap) ThreadPoolStatus(com.alibaba.cobar.manager.dataobject.cobarnode.ThreadPoolStatus) ArrayList(java.util.ArrayList) JSONObject(net.sf.json.JSONObject) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

CobarAdapterDAO (com.alibaba.cobar.manager.dao.CobarAdapterDAO)1 ThreadPoolStatus (com.alibaba.cobar.manager.dataobject.cobarnode.ThreadPoolStatus)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JSONObject (net.sf.json.JSONObject)1