Skip to content

Commit

Permalink
Rejection handler should indicate which task it's rejecting. Increase…
Browse files Browse the repository at this point in the history
… size of NMEA queue
  • Loading branch information
mendhak committed Sep 29, 2024
1 parent c809f0c commit 59a9f9a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ public class RejectionHandler implements RejectedExecutionHandler {

private static final Logger LOG = Logs.of(RejectionHandler.class);

private final String tag;
public RejectionHandler(String tag){
this.tag = tag;
}

@Override
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) {
LOG.warn(SessionLogcatAppender.MARKER_INTERNAL, "Could not queue task, some points may not be logged.");
LOG.warn(SessionLogcatAppender.MARKER_INTERNAL, "Could not queue task for {}, some points may not be logged.", tag);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

public class GeoJSONLogger implements FileLogger {
final static Object lock = new Object();
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(10), new RejectionHandler());
private final File file;
protected final String name;
protected static final String name = "GeoJSON";
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(10), new RejectionHandler(name));


public GeoJSONLogger(File file, boolean addNewTrackSegment) {
this.file = file;
name = "GeoJSON";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
public class Gpx10FileLogger implements FileLogger {
protected final static Object lock = new Object();

private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(10), new RejectionHandler());

private File gpxFile = null;
private final boolean addNewTrackSegment;
protected final String name = "GPX";
protected static final String name = "GPX";
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(10), new RejectionHandler(name));

public Gpx10FileLogger(File gpxFile, boolean addNewTrackSegment) {
this.gpxFile = gpxFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@

public class Kml22FileLogger implements FileLogger {
protected final static Object lock = new Object();
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(10), new RejectionHandler());
private final boolean addNewTrackSegment;
private final File kmlFile;
protected final String name = "KML";
protected static final String name = "KML";
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(10), new RejectionHandler(name));


public Kml22FileLogger(File kmlFile, boolean addNewTrackSegment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public class NmeaFileLogger {
protected final static Object lock = new Object();
private static final Logger LOG = Logs.of(NmeaFileLogger.class);
String fileName;
protected static final String name = "NMEA";
private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(10), new RejectionHandler());
new LinkedBlockingQueue<Runnable>(30), new RejectionHandler(name));

private PreferenceHelper preferenceHelper = PreferenceHelper.getInstance();
private Session session = Session.getInstance();
Expand Down

0 comments on commit 59a9f9a

Please sign in to comment.