package com.vip.sdk.utils_lib.thread;

/**
 * Author: rongjinsong(jason01.rong@vipshop.com)
 * Date: 2015-04-10
 * Time: 17:17
 * FIXME
 */
public abstract class AbstractThreadExecutor {
    private ThreadPool mPool;
    private Object mLock = new Object();

    public abstract ThreadPool initThreadManager();

    public void execut(Runnable task) {
        synchronized (mLock) {
            if (mPool == null) {
                mPool = initThreadManager();
            }
        }
        mPool.execute(task);
    }

    public void cancle(Runnable task){
        mPool.cancel(task);
    }
}
