Code example for ThreadPoolExecutor

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
Connect your IDE to all the code out there  Get Codota for Java