| java.lang.Object org.w3c.jigsaw.http.RequestTimeout org.w3c.jigsaw.http.socket.SocketClient
All known Subclasses: org.w3c.jigsaw.https.socket.SSLSocketClient,
SocketClient | public class SocketClient extends Client implements Runnable(Code) | | This class implements the object that handles client connections.
One such object exists per open connections at any given time.
The basic architecture is the following: the httpd instance accepts
new connections on its port. When such a connection is accepted a Client
object is requested to the client pool (which can implement what ever
strategy is suitable). Each request is than managed by looking up an
resource and invoking the resource methods corresponding to the request.
See Also: org.w3c.jigsaw.http.httpd See Also: org.w3c.jigsaw.http.Request See Also: org.w3c.jigsaw.http.Reply |
Method Summary | |
protected synchronized void | bind(Socket socket) SocketClientFactory interface - Bind the socket to this client.
Binding a socket to a client triggers the processing of the underlying
connection. | final public int | getBindCount() Get the total number of times this client was bound to a socket. | public InetAddress | getInetAddress() Client implementation - Get the IP address of this client. | protected Thread | getThread() Get the thread powering that client. | protected boolean | idleConnection() Client implementation - The current connection is idle. | public void | join() If this client is allocated a thread, join it. | protected synchronized void | kill(boolean now) SocketClientFactory interface - Kill this client. | public void | run() Run for our newly attached connection. | protected void | stopConnection() Client implementation - This connection has been stopped. | public String | toString() Print that client into a String. | protected synchronized void | unbind() SocketClientFactory interface - Unbind this client. | protected void | usedConnection() Client implementation - The current connection is in use. |
alive | protected boolean alive(Code) | | Is this client still alive ?
|
bindcount | protected int bindcount(Code) | | Number of times this client was bound to a connection.
|
done | protected boolean done(Code) | | are we done?
|
idle | protected boolean idle(Code) | | Our we idle (waiting for next request ?)
|
socket | protected Socket socket(Code) | | The socket currently handled by the client.
|
thread | protected Thread thread(Code) | | The thread that we have been attached to.
|
bind | protected synchronized void bind(Socket socket)(Code) | | SocketClientFactory interface - Bind the socket to this client.
Binding a socket to a client triggers the processing of the underlying
connection. It is assumed that the client was ready to handle a new
connection before this method was called.
Parameters: socket - The socket this client should now handle. |
getBindCount | final public int getBindCount()(Code) | | Get the total number of times this client was bound to a socket.
An integer, indicatingthe number of bind calls on this client. |
getInetAddress | public InetAddress getInetAddress()(Code) | | Client implementation - Get the IP address of this client.
An InetAddress instance, or null if theclient is not currently running. |
getThread | protected Thread getThread()(Code) | | Get the thread powering that client.
A Thread instance, or null. |
idleConnection | protected boolean idleConnection()(Code) | | Client implementation - The current connection is idle.
The client is about to wait for the next request from the net, mark
it as idle to make it a candidate for persistent connection closing.
A boolean, if true our client factory wantsus to stop right now, in order to handle some other connection. |
join | public void join()(Code) | | If this client is allocated a thread, join it.
|
kill | protected synchronized void kill(boolean now)(Code) | | SocketClientFactory interface - Kill this client.
The clean way for our client factory to shut us down unconditionally.
This will free all resources acquired by this client, stop the current
connection processing if needed, and terminate the underlying thread.
|
run | public void run()(Code) | | Run for our newly attached connection.
A boolean, true if the client is to be killedas decided by its SocketClientFactory creator. |
stopConnection | protected void stopConnection()(Code) | | Client implementation - This connection has been stopped.
Make sure the whole socket is closed, and be ready to handle
next connection.
|
toString | public String toString()(Code) | | Print that client into a String.
A String instance. |
unbind | protected synchronized void unbind()(Code) | | SocketClientFactory interface - Unbind this client.
This client is handling an idle connection, unbind it to make
it free for handling some other more buzy connection.
|
usedConnection | protected void usedConnection()(Code) | | Client implementation - The current connection is in use.
A request is about to be processed, mark that connection as used, to
remove it from the idle state.
|
|
|