|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cebit.server.idm.socket.IDMSocketClientFactory
This class handles the SSONET connections to this server, and it creates a ServerSocket for receiving connections.
The client pool is a kind of client factory. Each time the server gets a new connection, it calls the client pool to bound a client object (newly created or spared) to handle it.
Field Summary | |
(package private) boolean |
alive
|
static int |
AVG_DEAD
|
static int |
AVG_HIGH
|
static int |
AVG_LIGHT
|
static int |
AVG_NORMAL
|
(package private) java.net.InetAddress |
bindAddr
the daemon (Server) bind address for this factory |
static java.lang.String |
BINDADDR_P
Property name for internet address, where jigsaw is bound to. |
(package private) int |
busyCount
|
protected org.ssonet.net.CertificateListener |
certificateListener
The default certificate Listener used for all connections |
(package private) int |
clientCount
|
(package private) int |
clientEstim
|
(package private) int |
count
|
(package private) cebit.server.idm.socket.IDMSocketClientState |
csList
|
(package private) int |
freeCount
|
(package private) org.w3c.util.LRUList |
freeList
|
(package private) int |
idleCount
|
(package private) org.w3c.util.LRUList |
idleList
|
static int |
IDLETO
|
static java.lang.String |
IDLETO_P
Property name for the the timeout for idle clients, after which the connection is closed. |
(package private) int |
loadavg
|
(package private) int |
maxClients
the maximum number of clients |
static int |
MAXCLIENTS
|
static java.lang.String |
MAXCLIENTS_P
Property name for the maximum number of clients allowed. |
(package private) int |
maxFree
|
(package private) int |
maxIdle
|
static int |
MAXSPARE_FREE
|
static java.lang.String |
MAXSPARE_FREE_P
Property name for the maximum of free clients, which are allowed. |
static int |
MAXSPARE_IDLE
|
static java.lang.String |
MAXSPARE_IDLE_P
Property name for the maximum of idle (connected, but waiting for new requests) clients, which are allowed. |
static int |
MAXTHREADS
|
static java.lang.String |
MAXTHREADS_P
Property name for the maximum number of threads, which might be used for Jigsaw. |
(package private) int |
minFree
|
static int |
MINSPARE_FREE
|
static java.lang.String |
MINSPARE_FREE_P
Property name for the minimum number of free clients, which must be available. |
(package private) org.w3c.util.ObservableProperties |
props
|
(package private) org.w3c.jigsaw.http.httpd |
server
the daemon (Server) of this factory |
(package private) org.w3c.util.ThreadCache |
threadcache
|
Fields inherited from interface org.ssonet.net.ConnectionListener |
FINISHED_STATE, INIT_STATE, MECHANISMS_NEGOTIATION, NOT_STARTED_STATE, RUNNING_STATE, SECURITY_GOAL_NEGOTIATION |
Constructor Summary | |
IDMSocketClientFactory()
default constructor of this factory |
Method Summary | |
protected cebit.server.idm.socket.IDMSocketClientState |
addClient(boolean free)
Create a new IDMSocketClient for the pool. |
protected boolean |
clientConnectionFinished(cebit.server.idm.socket.IDMSocketClient client)
X--X Notify that this client has finished with its connection. |
protected void |
clientFinished(cebit.server.idm.socket.IDMSocketClient client)
X--X Notify that this client has been killed. |
void |
connectionStateChanged(org.ssonet.net.SSONETContext context,
int currentState)
|
org.ssonet.net.SSONETContext |
createContext()
Creates a SSONETContext (Method of SSONETContextFactory) |
java.net.ServerSocket |
createServerSocket()
method for creating a SSONET server socket |
boolean |
decideSecurityGoal(int securityGoal,
org.ssonet.net.ActionConfiguration ownConfiguration,
org.ssonet.net.SSONETContext context)
Handles a solvable conflict during security goal negotiation |
protected void |
deleteClient(cebit.server.idm.socket.IDMSocketClientState cs)
X--X Remove this client state from the glohbal client list. |
boolean |
doWarning(java.lang.String chainname,
idman.rules.Condition cond,
java.lang.String id,
byte[] content,
idman.mngt.Context context,
java.lang.String parameter)
Receive warnings from ChainEvaluator for finding the Pseudonym for receiving requests. |
java.lang.String |
getHTMLStatus()
X--X Give the status of this class as a partial HTML text which will be added into a block level element |
void |
handleConnection(java.net.Socket socket)
X--X Handle the given connection. |
protected boolean |
idleClientRemove(cebit.server.idm.socket.IDMSocketClient client)
X--X Removes an idle client from the list, updates only the idle list as the free count has already be accessed |
void |
initialize(org.w3c.jigsaw.http.httpd server)
method for intializing this factory |
protected void |
killClients(boolean force)
|
protected void |
killSomeClients()
|
protected void |
killSomeClients(int howmany)
|
void |
negotiationRequestReceived(org.ssonet.net.SSONETContext context,
int negotiationType)
|
protected boolean |
notifyIdle(cebit.server.idm.socket.IDMSocketClient client)
X--X The client notifies the pool that it enters idle state. |
protected void |
notifyUse(cebit.server.idm.socket.IDMSocketClient client)
X--X The client notifies the pool that is has been activated. |
boolean |
propertyChanged(java.lang.String name)
method for handling a dynamic property modification |
protected void |
run(cebit.server.idm.socket.IDMSocketClient client)
|
void |
shutdown(boolean force)
Shutdown the client pool. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.ssonet.net.CertificateListener certificateListener
org.w3c.jigsaw.http.httpd server
java.net.InetAddress bindAddr
int maxClients
public static final int MINSPARE_FREE
public static final int MAXSPARE_FREE
public static final int MAXSPARE_IDLE
public static final int MAXTHREADS
public static final int MAXCLIENTS
public static final int IDLETO
public static final int AVG_LIGHT
public static final int AVG_NORMAL
public static final int AVG_HIGH
public static final int AVG_DEAD
public static final java.lang.String MINSPARE_FREE_P
public static final java.lang.String MAXSPARE_FREE_P
public static final java.lang.String MAXSPARE_IDLE_P
public static final java.lang.String MAXTHREADS_P
public static final java.lang.String MAXCLIENTS_P
public static final java.lang.String IDLETO_P
public static final java.lang.String BINDADDR_P
int minFree
int maxFree
int maxIdle
int count
org.w3c.util.ObservableProperties props
int busyCount
org.w3c.util.LRUList idleList
org.w3c.util.LRUList freeList
cebit.server.idm.socket.IDMSocketClientState csList
int idleCount
int freeCount
int clientCount
int clientEstim
org.w3c.util.ThreadCache threadcache
int loadavg
boolean alive
Constructor Detail |
public IDMSocketClientFactory()
Method Detail |
public java.net.ServerSocket createServerSocket() throws java.io.IOException
createServerSocket
in interface org.w3c.jigsaw.http.ClientFactory
java.io.IOException
public void initialize(org.w3c.jigsaw.http.httpd server)
initialize
in interface org.w3c.jigsaw.http.ClientFactory
server
- the daemon of this factorypublic org.ssonet.net.SSONETContext createContext()
createContext
in interface org.ssonet.net.SSONETContextFactory
public boolean decideSecurityGoal(int securityGoal, org.ssonet.net.ActionConfiguration ownConfiguration, org.ssonet.net.SSONETContext context)
decideSecurityGoal
in interface org.ssonet.net.ConnectionListener
public boolean doWarning(java.lang.String chainname, idman.rules.Condition cond, java.lang.String id, byte[] content, idman.mngt.Context context, java.lang.String parameter)
doWarning
in interface idman.rules.ChainEvaluationListener
protected cebit.server.idm.socket.IDMSocketClientState addClient(boolean free)
free
- A boolean, if true the client is inserted
straight into the free list, otherwise, it is not plugged into any
list.
public java.lang.String getHTMLStatus()
getHTMLStatus
in interface org.w3c.util.Status
public boolean propertyChanged(java.lang.String name)
propertyChanged
in interface org.w3c.util.PropertyMonitoring
name
- the name of the property modified
protected void deleteClient(cebit.server.idm.socket.IDMSocketClientState cs)
cs
- The client state to remove from the list.protected boolean idleClientRemove(cebit.server.idm.socket.IDMSocketClient client)
client
- the socket to remove from the idle listprotected boolean clientConnectionFinished(cebit.server.idm.socket.IDMSocketClient client)
client
- The client that is done with its connection.protected void clientFinished(cebit.server.idm.socket.IDMSocketClient client)
client
- The client that has terminate.protected void notifyUse(cebit.server.idm.socket.IDMSocketClient client)
This method needs not be synchronized, as it affect only the client state, not the client list.
client
- The activated client.protected boolean notifyIdle(cebit.server.idm.socket.IDMSocketClient client)
This method needs not be synchronized, as it affect only the client state, not the client list.
client
- The client that is going to be idle.protected void killSomeClients(int howmany)
protected final void killSomeClients()
protected void run(cebit.server.idm.socket.IDMSocketClient client)
public void handleConnection(java.net.Socket socket)
A client enters the LRU list (and become a candidate for kill) only
after it has handle one request (or if some timeout expires). This is
performed by the first call to notifyUse
which will
silently insert the client into the LRU if it was not there already.
This client pool does a lot of nice thinigs, but could probably be implemented in a much better way (while keeping the features it has). Contention arond the pool is probably concern number 1 of performances.
handleConnection
in interface org.w3c.jigsaw.http.ClientFactory
socket
- The connection to handle.protected void killClients(boolean force)
public void shutdown(boolean force)
shutdown
in interface org.w3c.jigsaw.http.ClientFactory
force
- Should we interrupt running clients.public void negotiationRequestReceived(org.ssonet.net.SSONETContext context, int negotiationType)
negotiationRequestReceived
in interface org.ssonet.net.ConnectionListener
public void connectionStateChanged(org.ssonet.net.SSONETContext context, int currentState)
connectionStateChanged
in interface org.ssonet.net.ConnectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |