Code example for ThreadPoolExecutor

0
import java.util.concurrent.TimeUnit; 
 
public class Kml22FileLogger implements IFileLogger 
{ 
    protected final static Object lock = new Object();
    private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
            new LinkedBlockingQueue<Runnable>(128), new RejectionHandler());
    private final boolean addNewTrackSegment;
    private final File kmlFile;
    protected final String name = "KML";
 
    public Kml22FileLogger(File kmlFile, boolean addNewTrackSegment)
    { 
        this.kmlFile = kmlFile;
        this.addNewTrackSegment = addNewTrackSegment;
    } 
 
 
    public void Write(Location loc) throws Exception
    { 
        Kml22WriteHandler writeHandler = new Kml22WriteHandler(loc, kmlFile, addNewTrackSegment);