1.
package com.task;
import java.io.File;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class SyncTreadPool extends ThreadPoolExecutor {
public SyncTreadPool() {
super(2, 4, 5, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(2000), new ThreadPoolExecutor.CallerRunsPolicy());
}
public static class Task implements Runnable {
private Log log = LogFactory.getLog(this.getClass().getName());
private SyncAllWhiteListFileTreadPool fileTreadPool;
public Task(SyncAllWhiteListFileTreadPool fileTreadPool) {
this.fileTreadPool = fileTreadPool;
}
@Override
public void run() {
// code
}
}
}