public class XmlRpcServerConnection
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
static byte[] |
CLOSE_CONNECTION
Byte array for a Close Connection header
|
static byte[] |
CONTENT_LENGTH
Byte array for the Content Length header
|
static byte[] |
CONTENT_TYPE
Byte array for the Content Type header
|
static byte[] |
CRLF
Byte array for the end of HTTP headers mark
|
static byte[] |
ERROR
Byte array for an HTTP IE header
|
static byte[] |
GZIP_ENCODING
Byte array for the GZIP Encoding header
|
static byte[] |
KEEP_CONNECTION
Byte array for a Keep Connection header
|
static byte[] |
OK
Byte array for an HTTP OK header
|
static byte[] |
SERVER
Byte array for the server header
|
Constructor and Description |
---|
XmlRpcServerConnection()
Marks the thread with a prefix and sequence number so we may trace which thread
is doing what.
|
Modifier and Type | Method and Description |
---|---|
static XmlRpcServerConnection |
getConnection(XmlRpcDispatcher dispatcher)
Retrieves a connection from the pool or creates a new one, assuming we have not reached
the connection limit.
|
void |
handleConnection(java.net.Socket socket)
The thread executing the handleConnection() is the thread that is accepting connections
in the XmlRpcServer.runAsService() method.
|
static java.lang.String |
readHttpHeader(java.io.InputStream is,
byte[] httpBuffer)
Reads a string from the supplied input string.
|
void |
run()
The XmlRpcServerConnection thread runs indefinitely, or until interrupted, handling XML-RPC
messages on the socket assigned in handleConnection().
|
static void |
setLimits(int connectionLimit,
int poolLimit)
Sets the maximum allowed number of simultaneously active connections, and the
number of connections that should be pooled.
|
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, toString, yield
public static final byte[] OK
public static final byte[] ERROR
public static final byte[] SERVER
public static final byte[] CLOSE_CONNECTION
public static final byte[] KEEP_CONNECTION
public static final byte[] CONTENT_TYPE
public static final byte[] GZIP_ENCODING
public static final byte[] CONTENT_LENGTH
public static final byte[] CRLF
public XmlRpcServerConnection()
public static XmlRpcServerConnection getConnection(XmlRpcDispatcher dispatcher)
dispatcher
- The dispatcher this connection shall use when the HTTP information ha
been extracted from the call.public static void setLimits(int connectionLimit, int poolLimit)
Lowering the connection limit or pool limit during operation will not immediately affect the number of connections or connections in the pool. They will be decreased as requests are handled and connections are disposed after those requests.
connectionLimit
- The maximum allowed number of active connectionspoolLimit
- The number of connections to poolpublic void handleConnection(java.net.Socket socket)
socket
- The socket containing the XML-RPC post to be handled.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static java.lang.String readHttpHeader(java.io.InputStream is, byte[] httpBuffer) throws java.io.IOException
is
- The input stream to read an HTTP header fromjava.io.IOException