01: /*
02: * WbThread.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.util;
13:
14: import workbench.log.LogMgr;
15:
16: /**
17: *
18: * @author support@sql-workbench.net
19: */
20: public class WbThread extends Thread implements
21: Thread.UncaughtExceptionHandler {
22:
23: public WbThread(String name) {
24: super (name);
25: this .setDaemon(true);
26: this .setUncaughtExceptionHandler(this );
27: }
28:
29: public WbThread(Runnable run, String name) {
30: super (run, name);
31: this .setDaemon(true);
32: this .setUncaughtExceptionHandler(this );
33: }
34:
35: public void uncaughtException(Thread thread, Throwable error) {
36: LogMgr.logError("WbThread.uncaughtException()", "Thread + "
37: + thread.getName() + " caused an exception", error);
38: }
39: }
|