KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > connector > grizzly > Pipeline


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.web.connector.grizzly;
24
25 /**
26  * An interface used as a wrapper around any kind of thread pool
27  *
28  * @author Jean-Francois Arcand
29  */

30 public interface Pipeline {
31
32     /**
33      * Add an <code>Task</code> to be processed by this <code>Pipeline</code>
34      */

35     public void addTask(Task task) ;
36
37
38     /**
39      * Return a <code>Task</code> object available in the pipeline.
40      */

41     public Task getTask() ;
42     
43    
44    /**
45      * Return the number of waiting threads.
46      */

47     public int getWaitingThread();
48     
49     
50     /**
51      * Return the number of threads used by this pipeline.
52      */

53     public int getMaxThreads();
54     
55     
56     /**
57      * Return the number of active threads.
58      */

59     public int getCurrentThreadCount() ;
60       
61       
62     /**
63      * Return the curent number of threads that are currently processing
64      * a task.
65      */

66     public int getCurrentThreadsBusy();
67     
68    
69     /**
70      * Init the <code>Pipeline</code> by initializing the required
71      * <code>WorkerThread</code>. Default value is 10
72      */

73     public void initPipeline();
74
75
76     /**
77      * Return the name of this <code>Pipeline</code>
78      */

79     public String JavaDoc getName();
80
81
82     /**
83      * Start the <code>Pipeline</code>
84      */

85     public void startPipeline();
86     
87
88     /**
89      * Stop the <code>Pipeline</code>
90      */

91     public void stopPipeline();
92
93     
94     /**
95      * Set the <code>Thread</code> priority used when creating new threads.
96      */

97     public void setPriority(int priority);
98     
99     
100     /**
101      * Set the maximum thread this pipeline can handle.
102      */

103     public void setMaxThreads(int maxThread);
104     
105     
106     /**
107      * Set the minimum thread this pipeline can handle.
108      */

109     public void setMinThreads(int minThread);
110     
111     
112     /**
113      * Set the port this <code>Pipeline</code> is associated with.
114      */

115     public void setPort(int port);
116     
117     
118     /**
119      * Set the name of this <code>Pipeline</code>
120      */

121     public void setName(String JavaDoc name);
122    
123     
124     /**
125      * Set the maximum pending connection this <code>Pipeline</code>
126      * can handle.
127      */

128     public void setQueueSizeInBytes(int maxQueueSizeInBytesCount);
129     
130    
131     /**
132      * Set the number the <code>Pipeline</code> will use when increasing the
133      * thread pool
134      */

135     public void setThreadsIncrement(int processorThreadsIncrement);
136     
137     
138     /**
139      * Set the timeout value a thread will use to times out the request.
140      */

141     public void setThreadsTimeout(int processorThreadsTimeout);
142     
143
144     /**
145      * Set the <code>PipelineStatistic</code> object used
146      * to gather statistic;
147      */

148     public void setPipelineStatistic(PipelineStatistic pipelineStatistic);
149     
150     
151     /**
152      * Return the <code>PipelineStatistic</code> object used
153      * to gather statistic;
154      */

155     public PipelineStatistic getPipelineStatistic();
156
157
158     /**
159      * Returns the number of tasks in this <code>Pipeline</code>.
160      *
161      * @return Number of tasks in this <code>Pipeline</code>.
162      */

163     public int size();
164
165
166     // ------------------- Not used, compatibility with 8.1 --------------/
167
/**
168      * Return the number of maximum spare thread.
169      */

170     public int getMaxSpareThreads();
171
172     /**
173      * Return the number of minimum spare thread.
174      */

175     public int getMinSpareThreads();
176
177
178     /**
179      * Set the number of minimum spare thread.
180      */

181     public void setMinSpareThreads(int minSpareThreads);
182     
183     
184     /**
185      * Interrup the <code>Thread</code> using it thread id
186      */

187     public boolean interruptThread(long threadId);
188 }
189
Popular Tags