KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > restart > TestThreadGroup


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.restart;
5
6 import java.util.Collection JavaDoc;
7 import java.util.Collections JavaDoc;
8 import java.util.HashSet JavaDoc;
9 import java.util.Set JavaDoc;
10
11 public class TestThreadGroup extends ThreadGroup JavaDoc {
12
13   public TestThreadGroup(ThreadGroup JavaDoc parent, String JavaDoc name) {
14     super(parent, name);
15   }
16
17   private final Set JavaDoc throwables = Collections.synchronizedSet(new HashSet JavaDoc());
18
19   public void uncaughtException(Thread JavaDoc thread, Throwable JavaDoc throwable) {
20     super.uncaughtException(thread, throwable);
21     throwables.add(throwable);
22   }
23   
24   public Collection JavaDoc getErrors() {
25     return new HashSet JavaDoc(throwables);
26   }
27 }
Popular Tags