|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
CADI.Server.Core.Scheduler
public class Scheduler
This class performs the control of the listener/s and workers threads.
The listener/s are the thread/s where the client request are received, and workers are a thread pool that process the requests and send the response to the client.
Usage example:
construct
setParameters
run
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private java.lang.String |
cachePath
Is the path directory that will be used to save the temporary files used to cache client data. |
private ClientSessions |
clientSessions
It is a list that contains information about the clients that are being served. |
private int |
deliveryProgressionOrder
Definition in Worker.deliveryProgressionOrder. |
private boolean |
finish
Indicates when the scheduler has to finish |
private boolean |
independentMessageHeaders
Definition in JPIPMessageEncoder.independentForm. |
private int |
keepAliveTimeout
It is the timeout (in milliseconds) that will be used to wait for a new client request when the HTTP keep-alive mode is set. |
private CADILog |
log
It is an object that will be used to log the server process |
private boolean |
logEnabled
Indicates whether the log is enabled or disabled. |
private java.lang.String |
logFile
It is the file name where the server logs are stored. |
private LogicalTargetList |
logicalTargetList
It is a list that contais information about the logical targets (typically an image) that are being served. |
private float |
maxTxRate
Is the maximum rate (bytes per second) which will be used to delivery data from the server to the client. 0 value means unlimited. |
private int |
numOfWorkers
Indicates the number of threads of the Worker that will
be running. |
private int[] |
ports
Ports where the server is listening to the client requests. |
private int |
rateDistortionMethod
Indicates the rate distortion method that will be used with JPEG2000 logical targets. |
private int |
RDSubType
Indicates a type within the rate distortion method. |
private RequestListener[] |
requestListenersPool
This thread pool will listen to in a port to receive client requests. |
private RequestQueue |
requestQueue
It is a queue where the client request are stored. |
private java.lang.String |
targetsPath
Is the path directory where the logical targets are stored. |
private TasksQueue[] |
tasksQueue
Is an array of queues to storage the tasks for each Worker thread. |
private Worker[] |
workersPool
This thread pool will process the client requests and will send the server responses to the client. |
private boolean |
XMLLogFormat
Indicates whether the log information is stored in XML format or simple text format. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Scheduler(int[] ports,
int numOfWorkers,
boolean logEnabled,
int logLevel,
java.lang.String logFile,
boolean XMLLogFormat)
Constructor. |
|
| Method Summary | |
|---|---|
void |
finish()
This method is used to indicate that the thread has to finish. |
private void |
launchListeners()
|
private void |
launchWorkers()
|
void |
list(java.io.PrintStream out)
Prints this Scheduler's fields to the specified output stream. |
void |
run()
This method manages the RequestListener pool and the
Worker pool. |
void |
setCachePath(java.lang.String cachePath)
Sets the cachePath attribute. |
void |
setDeliveryProgressionOrder(int deliveryProgressionOrder)
Sets the deliveryProgressionOrder attribute. |
void |
setIndependentMessageHeaders(boolean independentMessageHeaders)
Sets the #independentMesssageHeaders attribute. |
void |
setKeepAliveTimeout(int keepAliveTimeout)
Sets the keepAliveTimeout attribute. |
void |
setMaxTxRate(float maxTxRate)
Sets the maxTxRate attribute. |
void |
setRateDistortionMethod(int rateDistortionMethod,
int RDSubType)
Sets the rate-distortion method and the subrate-distortion method. |
void |
setTargetsPath(java.lang.String targetsPath)
Sets the targetsPath attribute. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int[] ports
private int numOfWorkers
Worker that will
be running.
private java.lang.String logFile
private boolean XMLLogFormat
private boolean logEnabled
private int keepAliveTimeout
private float maxTxRate
Only positive values are allowed.
private boolean independentMessageHeaders
JPIPMessageEncoder.independentForm.
private java.lang.String targetsPath
private java.lang.String cachePath
private int rateDistortionMethod
private int RDSubType
private int deliveryProgressionOrder
Worker.deliveryProgressionOrder.
private RequestListener[] requestListenersPool
private Worker[] workersPool
private RequestQueue requestQueue
private LogicalTargetList logicalTargetList
private ClientSessions clientSessions
private TasksQueue[] tasksQueue
Worker thread. Therefore, each queue of the array
belongs to a Workder.
private CADILog log
private boolean finish
| Constructor Detail |
|---|
public Scheduler(int[] ports,
int numOfWorkers,
boolean logEnabled,
int logLevel,
java.lang.String logFile,
boolean XMLLogFormat)
ports - they are the ports where the server will listen to the
client request.numOfWorkers - they are the number of workers that will be launched to
process the client request.logEnabled - definition in logEnabledlogLevel - definition in CADILog.logLevellogFile - definition in logFile.XMLLogFormat - definition in XMLLogFormat.
ErrorException - when the server can not be launched because the
server socket can not be opened it will be thrown.| Method Detail |
|---|
public void setTargetsPath(java.lang.String targetsPath)
targetsPath attribute.
targetsPath - definition in targetsPath.public void setCachePath(java.lang.String cachePath)
cachePath attribute.
cachePath - definition in cachePath.
public void setRateDistortionMethod(int rateDistortionMethod,
int RDSubType)
rateDistortionMethod - definition in rateDistortionMethod.RDSubType - definition in RDSubType.public void setDeliveryProgressionOrder(int deliveryProgressionOrder)
deliveryProgressionOrder attribute.
deliveryProgressionOrder - definition in deliveryProgressionOrder.public void setKeepAliveTimeout(int keepAliveTimeout)
keepAliveTimeout attribute.
keepAliveTimeout - definition in keepAliveTimeout.public void setMaxTxRate(float maxTxRate)
maxTxRate attribute.
maxTxRate - definition in maxTxRate attribute.public void setIndependentMessageHeaders(boolean independentMessageHeaders)
#independentMesssageHeaders attribute.
independentMesssageHeaders - definition in #independentMesssageHeaders attribute.public void run()
RequestListener pool and the
Worker pool. It gets the client request (received by the
RequestListener) and assigns the tasks to the Worker
.
The method will be running until the finish attibute is set
to false.
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void finish()
public java.lang.String toString()
toString in class java.lang.Threadpublic void list(java.io.PrintStream out)
out - an output stream.
private void launchListeners()
throws ErrorException
ErrorExceptionprivate void launchWorkers()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||