/www/tags/NOV_07_2009/htdocs/api/org/gjt/sp/util/WorkThreadPool.html
HTML | 403 lines | 342 code | 49 blank | 12 comment | 0 complexity | 01c94ddf741ee186c73bb1331c7b6557 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.5.0_14) on Tue Jul 22 07:14:17 GMT-08:00 2008 -->
6<TITLE>
7WorkThreadPool (jEdit API)
8</TITLE>
9
10<META NAME="keywords" CONTENT="org.gjt.sp.util.WorkThreadPool class">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14
15<NOSCRIPT>
16</NOSCRIPT>
17
18</HEAD>
19
20<BODY BGCOLOR="white" >
21
22
23<!-- ========= START OF TOP NAVBAR ======= -->
24<A NAME="navbar_top"><!-- --></A>
25<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
26<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
27<TR>
28<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
29<A NAME="navbar_top_firstrow"><!-- --></A>
30<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
31 <TR ALIGN="center" VALIGN="top">
32 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
33 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
34 <TD BGCOLOR="#00008B" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
35 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/WorkThreadPool.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
36 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
40 </TR>
41</TABLE>
42</TD>
43<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
44</EM>
45</TD>
46</TR>
47
48<TR>
49<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
50 <A HREF="../../../../org/gjt/sp/util/WorkThread.Abort.html" title="class in org.gjt.sp.util"><B>PREV CLASS</B></A>
51 <A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util"><B>NEXT CLASS</B></A></FONT></TD>
52<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
53 <A HREF="../../../../index.html?org/gjt/sp/util/WorkThreadPool.html" target="_top"><B>FRAMES</B></A>
54 <A HREF="WorkThreadPool.html" target="_top"><B>NO FRAMES</B></A>
55
56<NOSCRIPT>
57 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
58</NOSCRIPT>
59
60
61</FONT></TD>
62</TR>
63<TR>
64<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
65 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
66<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
67DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
68</TR>
69</TABLE>
70<A NAME="skip-navbar_top"></A>
71<!-- ========= END OF TOP NAVBAR ========= -->
72
73<HR>
74<!-- ======== START OF CLASS DATA ======== -->
75<H2>
76<FONT SIZE="-1">
77org.gjt.sp.util</FONT>
78<BR>
79Class WorkThreadPool</H2>
80<PRE>
81java.lang.Object
82 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.gjt.sp.util.WorkThreadPool</B>
83</PRE>
84<HR>
85<DL>
86<DT><PRE>public class <B>WorkThreadPool</B><DT>extends java.lang.Object</DL>
87</PRE>
88
89<P>
90A pool of work threads.
91<P>
92
93<P>
94<DL>
95<DT><B>Since:</B></DT>
96 <DD>jEdit 2.6pre1</DD>
97<DT><B>See Also:</B><DD><A HREF="../../../../org/gjt/sp/util/WorkThread.html" title="class in org.gjt.sp.util"><CODE>WorkThread</CODE></A></DL>
98<HR>
99
100<P>
101
102<!-- ======== CONSTRUCTOR SUMMARY ======== -->
103
104<A NAME="constructor_summary"><!-- --></A>
105<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
106<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
107<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
108<B>Constructor Summary</B></FONT></TH>
109</TR>
110<TR BGCOLOR="white" CLASS="TableRowColor">
111<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#WorkThreadPool(java.lang.String, int)">WorkThreadPool</A></B>(java.lang.String name,
112 int count)</CODE>
113
114<BR>
115 Creates a new work thread pool with the specified number of
116 work threads.</TD>
117</TR>
118</TABLE>
119
120<!-- ========== METHOD SUMMARY =========== -->
121
122<A NAME="method_summary"><!-- --></A>
123<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
124<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
125<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
126<B>Method Summary</B></FONT></TH>
127</TR>
128<TR BGCOLOR="white" CLASS="TableRowColor">
129<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
130<CODE> void</CODE></FONT></TD>
131<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#addProgressListener(org.gjt.sp.util.WorkThreadProgressListener)">addProgressListener</A></B>(<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util">WorkThreadProgressListener</A> listener)</CODE>
132
133<BR>
134 Adds a progress listener to this thread pool.</TD>
135</TR>
136<TR BGCOLOR="white" CLASS="TableRowColor">
137<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
138<CODE> void</CODE></FONT></TD>
139<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#addWorkRequest(java.lang.Runnable, boolean)">addWorkRequest</A></B>(java.lang.Runnable run,
140 boolean inAWT)</CODE>
141
142<BR>
143 Adds a work request to the queue.</TD>
144</TR>
145<TR BGCOLOR="white" CLASS="TableRowColor">
146<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
147<CODE> int</CODE></FONT></TD>
148<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#getRequestCount()">getRequestCount</A></B>()</CODE>
149
150<BR>
151 Returns the number of pending requests.</TD>
152</TR>
153<TR BGCOLOR="white" CLASS="TableRowColor">
154<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
155<CODE> <A HREF="../../../../org/gjt/sp/util/WorkThread.html" title="class in org.gjt.sp.util">WorkThread</A></CODE></FONT></TD>
156<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#getThread(int)">getThread</A></B>(int index)</CODE>
157
158<BR>
159 Returns the specified thread.</TD>
160</TR>
161<TR BGCOLOR="white" CLASS="TableRowColor">
162<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
163<CODE> int</CODE></FONT></TD>
164<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#getThreadCount()">getThreadCount</A></B>()</CODE>
165
166<BR>
167 Returns the number of threads in this pool.</TD>
168</TR>
169<TR BGCOLOR="white" CLASS="TableRowColor">
170<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
171<CODE> void</CODE></FONT></TD>
172<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#removeProgressListener(org.gjt.sp.util.WorkThreadProgressListener)">removeProgressListener</A></B>(<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util">WorkThreadProgressListener</A> listener)</CODE>
173
174<BR>
175 Removes a progress listener from this thread pool.</TD>
176</TR>
177<TR BGCOLOR="white" CLASS="TableRowColor">
178<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
179<CODE> void</CODE></FONT></TD>
180<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#start()">start</A></B>()</CODE>
181
182<BR>
183 Starts all the threads in this thread pool.</TD>
184</TR>
185<TR BGCOLOR="white" CLASS="TableRowColor">
186<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
187<CODE> void</CODE></FONT></TD>
188<TD><CODE><B><A HREF="../../../../org/gjt/sp/util/WorkThreadPool.html#waitForRequests()">waitForRequests</A></B>()</CODE>
189
190<BR>
191 Waits until all requests are complete.</TD>
192</TR>
193</TABLE>
194 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
195<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
196<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
197<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
198</TR>
199<TR BGCOLOR="white" CLASS="TableRowColor">
200<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
201</TR>
202</TABLE>
203
204<P>
205
206<!-- ========= CONSTRUCTOR DETAIL ======== -->
207
208<A NAME="constructor_detail"><!-- --></A>
209<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
210<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
211<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
212<B>Constructor Detail</B></FONT></TH>
213</TR>
214</TABLE>
215
216<A NAME="WorkThreadPool(java.lang.String, int)"><!-- --></A><H3>
217WorkThreadPool</H3>
218<PRE>
219public <B>WorkThreadPool</B>(java.lang.String name,
220 int count)</PRE>
221<DL>
222<DD>Creates a new work thread pool with the specified number of
223 work threads.
224<P>
225<DL>
226<DT><B>Parameters:</B><DD><CODE>name</CODE> - The thread name prefix<DD><CODE>count</CODE> - The number of work threads</DL>
227</DL>
228
229<!-- ============ METHOD DETAIL ========== -->
230
231<A NAME="method_detail"><!-- --></A>
232<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
233<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
234<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
235<B>Method Detail</B></FONT></TH>
236</TR>
237</TABLE>
238
239<A NAME="start()"><!-- --></A><H3>
240start</H3>
241<PRE>
242public void <B>start</B>()</PRE>
243<DL>
244<DD>Starts all the threads in this thread pool.
245<P>
246<DD><DL>
247</DL>
248</DD>
249</DL>
250<HR>
251
252<A NAME="addWorkRequest(java.lang.Runnable, boolean)"><!-- --></A><H3>
253addWorkRequest</H3>
254<PRE>
255public void <B>addWorkRequest</B>(java.lang.Runnable run,
256 boolean inAWT)</PRE>
257<DL>
258<DD>Adds a work request to the queue.
259<P>
260<DD><DL>
261<DT><B>Parameters:</B><DD><CODE>run</CODE> - The runnable<DD><CODE>inAWT</CODE> - If true, will be executed in AWT thread. Otherwise,
262 will be executed in work thread</DL>
263</DD>
264</DL>
265<HR>
266
267<A NAME="waitForRequests()"><!-- --></A><H3>
268waitForRequests</H3>
269<PRE>
270public void <B>waitForRequests</B>()</PRE>
271<DL>
272<DD>Waits until all requests are complete.
273<P>
274<DD><DL>
275</DL>
276</DD>
277</DL>
278<HR>
279
280<A NAME="getRequestCount()"><!-- --></A><H3>
281getRequestCount</H3>
282<PRE>
283public int <B>getRequestCount</B>()</PRE>
284<DL>
285<DD>Returns the number of pending requests.
286<P>
287<DD><DL>
288
289<DT><B>Returns:</B><DD>the pending request count</DL>
290</DD>
291</DL>
292<HR>
293
294<A NAME="getThreadCount()"><!-- --></A><H3>
295getThreadCount</H3>
296<PRE>
297public int <B>getThreadCount</B>()</PRE>
298<DL>
299<DD>Returns the number of threads in this pool.
300<P>
301<DD><DL>
302
303<DT><B>Returns:</B><DD>the thread count</DL>
304</DD>
305</DL>
306<HR>
307
308<A NAME="getThread(int)"><!-- --></A><H3>
309getThread</H3>
310<PRE>
311public <A HREF="../../../../org/gjt/sp/util/WorkThread.html" title="class in org.gjt.sp.util">WorkThread</A> <B>getThread</B>(int index)</PRE>
312<DL>
313<DD>Returns the specified thread.
314<P>
315<DD><DL>
316<DT><B>Parameters:</B><DD><CODE>index</CODE> - The index of the thread
317<DT><B>Returns:</B><DD>a WorkThread</DL>
318</DD>
319</DL>
320<HR>
321
322<A NAME="addProgressListener(org.gjt.sp.util.WorkThreadProgressListener)"><!-- --></A><H3>
323addProgressListener</H3>
324<PRE>
325public void <B>addProgressListener</B>(<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util">WorkThreadProgressListener</A> listener)</PRE>
326<DL>
327<DD>Adds a progress listener to this thread pool.
328<P>
329<DD><DL>
330<DT><B>Parameters:</B><DD><CODE>listener</CODE> - The listener</DL>
331</DD>
332</DL>
333<HR>
334
335<A NAME="removeProgressListener(org.gjt.sp.util.WorkThreadProgressListener)"><!-- --></A><H3>
336removeProgressListener</H3>
337<PRE>
338public void <B>removeProgressListener</B>(<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util">WorkThreadProgressListener</A> listener)</PRE>
339<DL>
340<DD>Removes a progress listener from this thread pool.
341<P>
342<DD><DL>
343<DT><B>Parameters:</B><DD><CODE>listener</CODE> - The listener</DL>
344</DD>
345</DL>
346<!-- ========= END OF CLASS DATA ========= -->
347<HR>
348
349
350<!-- ======= START OF BOTTOM NAVBAR ====== -->
351<A NAME="navbar_bottom"><!-- --></A>
352<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
353<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
354<TR>
355<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
356<A NAME="navbar_bottom_firstrow"><!-- --></A>
357<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
358 <TR ALIGN="center" VALIGN="top">
359 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
360 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
361 <TD BGCOLOR="#00008B" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
362 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/WorkThreadPool.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
363 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
364 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
365 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
366 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
367 </TR>
368</TABLE>
369</TD>
370<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
371</EM>
372</TD>
373</TR>
374
375<TR>
376<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
377 <A HREF="../../../../org/gjt/sp/util/WorkThread.Abort.html" title="class in org.gjt.sp.util"><B>PREV CLASS</B></A>
378 <A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util"><B>NEXT CLASS</B></A></FONT></TD>
379<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
380 <A HREF="../../../../index.html?org/gjt/sp/util/WorkThreadPool.html" target="_top"><B>FRAMES</B></A>
381 <A HREF="WorkThreadPool.html" target="_top"><B>NO FRAMES</B></A>
382
383<NOSCRIPT>
384 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
385</NOSCRIPT>
386
387
388</FONT></TD>
389</TR>
390<TR>
391<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
392 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
393<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
394DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
395</TR>
396</TABLE>
397<A NAME="skip-navbar_bottom"></A>
398<!-- ======== END OF BOTTOM NAVBAR ======= -->
399
400<HR>
401
402</BODY>
403</HTML>