Code example for ExecutorService

Methods: submit

0
     * @param url 
     */ 
    public void addHistory(String url) {
        if (!TextUtils.isEmpty(url) && !mHistorySet.contains(url)) {
            mHistorySet.add(url);
            mExecutorService.submit(new Runnable() {
 
                @Override 
                public void run() { 
                    storeHistory(); 
                } 
            }); 
        } 
    } 
 
    /** 
     * 清空历史记录 
     */ 
    public void clearHistory() { 
        mHistorySet.clear();
    }