    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Interface w3c.jigsaw.daemon.ClientFactory

public interface ClientFactory
extends Object

The ClientFactory interface describes a server's client pool management. Lying in between a Server instance and a set of Client instances, the ClientFactory is responsible for creating and managing some mapping between incomming connections and clients. Each client instance can be thought of as a specific protocol handler.

This interface describes the relationship between the client factory and it's associated server, and between the client factory and the client instances it has created.

##

handleConnection(Socket)
  Server side interface - Handle this incomming connection.
notifyDead(ServerClient)
  Client side interface - This client has been killed.
notifyIdle(ServerClient)
  Client side interface - This client is now idle, and interruptible.
notifyUse(ServerClient)
  Client side interface - This client is now in use, don't interrupt it ! This client is now processing some requests, it don't want to be interrupted (ie killed) until it is back to idle again.

##

handleConnection

      public abstract void handleConnection(Socket s)

  Server side interface - Handle this incomming connection. If some error occurs during the processing of this new connection, it is up to the factory to decide if emiting some error is appropriate.
  Parameters:
    socket - The connection that has been freshly accepted.

notifyIdle

      public abstract void notifyIdle(ServerClient client)

  Client side interface - This client is now idle, and interruptible. The client we created to handle some connection is now back to idle and is willing to be reused, it's the right time to keep track of it.
  Parameters:
    client - The client that gives us the notification.

notifyUse

      public abstract void notifyUse(ServerClient client)

  Client side interface - This client is now in use, don't interrupt it ! This client is now processing some requests, it don't want to be interrupted (ie killed) until it is back to idle again.

  A buzy client can still be killed ungracefully by using its `kill` method with true as the parameter.

  Parameters:
    client - The client that don't want to be disturbed.

notifyDead

      public abstract void notifyDead(ServerClient client)

  Client side interface - This client has been killed. The client has either encountered an abnormal situation, or has been kill by the factory, it is not reusable any more.

  Dead clients typically don't have an associated thread any more.

  Parameters:
    dead - The client dying in front of the factory.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index