Re: [Javagroups-development] jgroups threads and exceptions
Brought to you by:
belaban
From: Bela B. <be...@ya...> - 2006-01-19 09:55:51
|
Ok, done. All threads now belong to that global thread group. This is flat, except for the ConnectionTable threads which belong to a thread group which is a child of the default TG Bruce Schuchardt wrote: > Since there can be a lot of threads in a JGroups stack, it might be > useful to put them in one or more thread groups to better control > them. One thing that I often do with this is implement > uncaughtException in the thread group so I can see why a thread died. > > For instance, in Util there could be a static threadgroup: > > /** > * ThreadGroup to which JGroups threads belong > */ > private static ThreadGroup GROUP = new > ThreadGroup("JGroups Threads") { > public void uncaughtException(Thread t, Throwable e) { > StringWriter sw = new StringWriter(); > sw.write("uncaught exception in thread "); > sw.write(t.getName()); > LogFactory.getLog(JChannel.class).error("ThreadGroup: " + > sw.toString(), e); > } > }; > public static ThreadGroup getThreadGroup() { > return GROUP; > } > > and then, in Protocol and other places, use the group in creating threads > > public UpHandler(...) { > super(Util.getThreadGroup(), "tempname"); > this.mq=mq; > etc. > > -- Bela Ban Lead JGroups / JBossCache callto://belaban |