Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/android/api/JniExceptionHandler.java

Issue 6606493159784448: New JNI bindings (Closed)
Patch Set: Created March 14, 2014, 11:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 package org.adblockplus.android.api;
2
3 import java.util.concurrent.LinkedBlockingQueue;
4
5 public final class JniExceptionHandler
6 {
7 private static LogWorker logWorker = null;
8
9 static
10 {
11 logWorker = new LogWorker();
12 final Thread t = new Thread(logWorker);
13 t.setDaemon(true);
14 t.start();
15 }
16
17 public static void logException(final Throwable t)
18 {
19 logWorker.logException(t);
20 }
21
22 private final static class LogWorker implements Runnable
23 {
24 LinkedBlockingQueue<Throwable> exceptionQueue = new LinkedBlockingQueue<Thro wable>();
25
26 private void logException(final Throwable t)
27 {
28 this.exceptionQueue.offer(t);
29 }
30
31 @Override
32 public void run()
33 {
34 for (;;)
35 {
36 try
37 {
38 final Throwable t = this.exceptionQueue.take();
39 System.err.println("EXCEPTION: " + t);
40 }
41 catch (final InterruptedException ie)
42 {
43 break;
44 }
45 catch (final Throwable ex)
46 {
47 // TODO: Swallow or log?
48 }
49 }
50 }
51 }
52 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/android/api/FilterEngine.java ('k') | src/org/adblockplus/android/api/JsEngine.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld