Code example for ThreadPoolExecutor

Methods: execute, getQueue

0
    public void Write(Location loc) throws Exception
    { 
        String dateTimeString = Utilities.GetIsoDateTime(new Date(loc.getTime()));
 
        Gpx10WriteHandler writeHandler = new Gpx10WriteHandler(dateTimeString, gpxFile, loc, addNewTrackSegment, satelliteCount);
        Utilities.LogDebug(String.format("There are currently %s tasks waiting on the GPX10 EXECUTOR.", EXECUTOR.getQueue().size()));
        EXECUTOR.execute(writeHandler);
    } 
 
    public void Annotate(String description, Location loc) throws Exception
    { 
 
        String dateTimeString = Utilities.GetIsoDateTime(new Date(loc.getTime()));
 
        Gpx10AnnotateHandler annotateHandler = new Gpx10AnnotateHandler(description, gpxFile, loc, dateTimeString);
        Utilities.LogDebug(String.format("There are currently %s tasks waiting on the GPX10 EXECUTOR.", EXECUTOR.getQueue().size()));
        EXECUTOR.execute(annotateHandler);
 
    } 
 
    @Override