public class ProxyWorker
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected boolean |
busy
Indicates if the thread is carrying out a task.
|
protected long |
cumMessageBodiesLength
Attribute only for debugging purposes.
|
protected long |
cumMessageHeadersLength
Attribute only for debugging purposes.
|
protected boolean |
finish
Indicates whether the thread has to finish when it is working with a
request with the keep-alive mode set.
|
protected HTTPRequest |
httpRequest
Definition in
HTTPRequest . |
protected HTTPResponse |
httpResponse |
protected HTTPResponseSender |
httpResponseSender |
protected boolean |
independentMessageHeaders
Definition in
CADI.Server.Network.JPIPMessageEncoder#independentForm . |
protected JPIPResponseFields |
jpipResponseFields |
protected int |
keepAliveTimeout
Definition in
Scheduler.keepAliveTimeout . |
protected CADILog |
log
It is an object that will be used to log the server process
|
protected long |
maxTxRate
Definition in
Scheduler.maxTxRate . |
protected java.io.OutputStream |
os
Is an output stream that will be used to send the server response to the client.
|
protected RequestQueue |
requestQueue
Definition in
Proxy.requestQueue . |
protected java.net.Socket |
socket
Contains the client socket of which request is being processed.
|
protected int |
trafficShaping |
Constructor and Description |
---|
ProxyWorker(java.lang.String threadName,
RequestQueue requestQueue,
CADILog log)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
encodeJPIPResponseFields()
JPIP HEADERS (See ISO/IEC 15444-9 Annex D)
|
void |
finish()
This method is used to indicate that the thread has to finish.
|
java.lang.Thread.State |
getState() |
boolean |
isBusy()
This method is used to indicate if the thread is or no busy processing a
task.
|
void |
list(java.io.PrintStream out)
Prints this ProxyWorker out to the specified output stream.
|
protected void |
listenNewRequest() |
void |
run() |
protected void |
sendHTTPResponseError(int statusCode,
java.lang.String reasonPhrase)
This method will be used to send an HTTP error response to the client.
|
protected void |
sendHTTPResponseHeader(HTTPResponse httpResponse) |
void |
setIndependentMessageHeaders(boolean independentMessageHeaders)
Sets the
#independentMesssageHeaders attribute. |
void |
setKeepAliveTimeout(int keepAliveTimeout)
Sets the
keepAliveTimeout attribute. |
void |
setMaxTxRate(long maxTxRate)
Sets the
maxTxRate attribute. |
void |
setTrafficShaping(int trafficShaping)
Sets the
trafficShaping attribute. |
java.lang.String |
toString() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, 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
protected RequestQueue requestQueue
Proxy.requestQueue
.protected CADILog log
protected boolean finish
finish()
protected boolean busy
busy
attribute is false
.protected java.net.Socket socket
protected HTTPRequest httpRequest
HTTPRequest
.protected int keepAliveTimeout
Scheduler.keepAliveTimeout
.protected long maxTxRate
Scheduler.maxTxRate
.protected int trafficShaping
protected boolean independentMessageHeaders
CADI.Server.Network.JPIPMessageEncoder#independentForm
.protected java.io.OutputStream os
protected HTTPResponse httpResponse
protected JPIPResponseFields jpipResponseFields
protected HTTPResponseSender httpResponseSender
protected long cumMessageHeadersLength
protected long cumMessageBodiesLength
public ProxyWorker(java.lang.String threadName, RequestQueue requestQueue, CADILog log)
threadName
- requestQueue
- definition in requestQueue
.log
- definition in log
.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void finish()
public boolean isBusy()
true
if the thread is processing a task. Otherwise,
it returns false
.public java.lang.Thread.State getState()
getState
in class java.lang.Thread
public void setKeepAliveTimeout(int keepAliveTimeout)
keepAliveTimeout
attribute.keepAliveTimeout
- definition in keepAliveTimeout
.public void setMaxTxRate(long maxTxRate)
maxTxRate
attribute.maxTxRate
- definition in maxTxRate
attribute.public void setTrafficShaping(int trafficShaping)
trafficShaping
attribute.maxTxRate
- definition in trafficShaping
attribute.public void setIndependentMessageHeaders(boolean independentMessageHeaders)
#independentMesssageHeaders
attribute.independentMesssageHeaders
- definition in #independentMesssageHeaders
attribute.public java.lang.String toString()
toString
in class java.lang.Thread
public void list(java.io.PrintStream out)
out
- an output stream.protected void listenNewRequest() throws WarningException, ErrorException
WarningException
ErrorException
private void encodeJPIPResponseFields()
protected void sendHTTPResponseHeader(HTTPResponse httpResponse) throws WarningException
httpResponse
- WarningException
protected void sendHTTPResponseError(int statusCode, java.lang.String reasonPhrase)
statusCode
- definition in StatusCodes
.reasonPhrase
- a reason phrase related with the status code.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)