(String[] args)
| 6 | } |
| 7 | |
| 8 | public static void main(String[] args) throws Exception { |
| 9 | ((Thread.UncaughtExceptionHandler) Thread.currentThread().getThreadGroup()) |
| 10 | .uncaughtException(Thread.currentThread(), new Exception()); |
| 11 | |
| 12 | { Threads test = new Threads(); |
| 13 | Thread thread = new Thread(test); |
| 14 | |
| 15 | synchronized (test) { |
| 16 | thread.start(); |
| 17 | test.wait(); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | { Thread thread = new Thread() { |
| 22 | public void run() { |
| 23 | while (true) { |
| 24 | System.out.print("."); |
| 25 | try { |
| 26 | sleep(1000); |
| 27 | } catch (Exception e) { |
| 28 | System.out.println("thread interrupted? " + interrupted()); |
| 29 | break; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | }; |
| 34 | thread.start(); |
| 35 | |
| 36 | System.out.println("\nAbout to interrupt..."); |
| 37 | thread.interrupt(); |
| 38 | System.out.println("\nInterrupted!"); |
| 39 | } |
| 40 | |
| 41 | { Thread thread = new Thread() { |
| 42 | @Override |
| 43 | public void run() { |
| 44 | // do nothing |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | thread.start(); |
| 49 | thread.join(); |
| 50 | } |
| 51 | |
| 52 | System.out.println("finished; success? " + success); |
| 53 | |
| 54 | if (! success) { |
| 55 | System.exit(-1); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | public void run() { |
| 60 | int i = 0; |
nothing calls this directly
no test coverage detected