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

Delta Between Two Patch Sets: src/org/adblockplus/libadblockplus/JniExceptionHandler.java

Issue 6606493159784448: New JNI bindings (Closed)
Left Patch Set: Cleaned up namespace usage in cpp files. Created March 20, 2014, 3:17 p.m.
Right Patch Set: Removed TODO from AppInfo. Created April 11, 2014, 1:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/org/adblockplus/libadblockplus/FilterEngine.java ('k') | src/org/adblockplus/libadblockplus/JsEngine.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH
4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.libadblockplus;
19
20 import java.util.concurrent.LinkedBlockingQueue;
21
22 public final class JniExceptionHandler
23 {
24 private static LogWorker logWorker = null;
25
26 static
27 {
28 logWorker = new LogWorker();
29 final Thread t = new Thread(logWorker);
30 t.setDaemon(true);
31 t.start();
32 }
33
34 public static void logException(final Throwable t)
35 {
36 logWorker.logException(t);
37 }
38
39 private final static class LogWorker implements Runnable
40 {
41 LinkedBlockingQueue<Throwable> exceptionQueue = new LinkedBlockingQueue<Thro wable>();
42
43 private void logException(final Throwable t)
44 {
45 this.exceptionQueue.offer(t);
46 }
47
48 @Override
49 public void run()
50 {
51 for (;;)
52 {
53 try
54 {
55 final Throwable t = this.exceptionQueue.take();
56 // TODO: We need a log callback
57 System.err.println("EXCEPTION: " + t);
58 }
59 catch (final InterruptedException ie)
60 {
61 break;
62 }
63 catch (final Throwable ex)
64 {
65 // TODO: Swallow or log?
66 }
67 }
68 }
69 }
70 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld