KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > thread > ThreadInfo


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * ThreadInfo.java
20  *
21  * The information about a single thread running in coadunation.
22  */

23
24 package com.rift.coad.lib.thread;
25
26 // coadunation imports
27
import com.rift.coad.lib.security.UserSession;
28
29 /**
30  * The information about a single thread running in coadunation.
31  *
32  * @author Brett Chaldecott
33  */

34 public class ThreadInfo {
35     
36     // the classes member variables
37
private long threadId = 0;
38     private Class JavaDoc threadClass = null;
39     private UserSession user = null;
40     private Thread.State JavaDoc state = null;
41     private String JavaDoc info = null;
42     
43     /**
44      * Creates a new instance of ThreadInfo
45      *
46      * @param threadId The id of the thread this object represents.
47      * @param threadClass The reference to the thread class.
48      * @param user The user object.
49      * @param state The state of this thread.
50      */

51     public ThreadInfo(long threadId, Class JavaDoc threadClass, UserSession user,
52             Thread.State JavaDoc state, String JavaDoc info) {
53         this.threadId = threadId;
54         this.threadClass = threadClass;
55         this.user = user;
56         this.state = state;
57         this.info = info;
58     }
59     
60     
61     /**
62      * The getter method for the thread id.
63      *
64      * @return The id of the thread contained in a long value.
65      */

66     public long getThreadId() {
67         return threadId;
68     }
69     
70     
71     /**
72      * The getter method for the thread class object.
73      *
74      * @return The reference to the thread class.
75      */

76     public Class JavaDoc getThreadClass() {
77         return threadClass;
78     }
79     
80     
81     /**
82      * This method returns the user object reference for this thread.
83      *
84      * @return The reference to the user object.
85      */

86     public UserSession getUser() {
87         return user;
88     }
89     
90     
91     /**
92      * This method returns the state of the thread that this object contains
93      * information for.
94      *
95      * @return The reference to the current state.
96      */

97     public Thread.State JavaDoc getState() {
98         return state;
99     }
100     
101     
102     /**
103      * The information about this thread as provided by the thread.
104      *
105      * @return A string containing the information about this thread.
106      */

107     public String JavaDoc getInfo() {
108         return info;
109     }
110 }
111
Popular Tags