KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > util > IvyThread


1 package fr.jayasoft.ivy.util;
2
3 import fr.jayasoft.ivy.IvyContext;
4
5 /**
6  * A simple thread subclass associated the same IvyContext as the thread in which it is instanciated.
7  *
8  * If you override the run target, then you will have to call initContext() to do the association
9  * with the original IvyContext.
10  *
11  * @see IvyContext
12  * @author Xavier Hanin
13  */

14 public class IvyThread extends Thread JavaDoc {
15     private IvyContext _context = IvyContext.getContext();
16
17     public IvyThread() {
18         super();
19     }
20
21     public IvyThread(Runnable JavaDoc target, String JavaDoc name) {
22         super(target, name);
23     }
24
25     public IvyThread(Runnable JavaDoc target) {
26         super(target);
27     }
28
29     public IvyThread(String JavaDoc name) {
30         super(name);
31     }
32
33     public IvyThread(ThreadGroup JavaDoc group, Runnable JavaDoc target, String JavaDoc name, long stackSize) {
34         super(group, target, name, stackSize);
35     }
36
37     public IvyThread(ThreadGroup JavaDoc group, Runnable JavaDoc target, String JavaDoc name) {
38         super(group, target, name);
39     }
40
41     public IvyThread(ThreadGroup JavaDoc group, Runnable JavaDoc target) {
42         super(group, target);
43     }
44
45     public IvyThread(ThreadGroup JavaDoc group, String JavaDoc name) {
46         super(group, name);
47     }
48
49     public void run() {
50         initContext();
51         super.run();
52     }
53
54     protected void initContext() {
55         IvyContext.setContext(_context);
56     }
57 }
58
Popular Tags