KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > coldcore > coloradoftp > connection > ConnectionPool


1 package com.coldcore.coloradoftp.connection;
2
3 import java.util.Set JavaDoc;
4
5 /**
6  * Pool of active connections.
7  *
8  * All connections should be added to connection pools. Connection pools process connections'
9  * self-service routines. If a connection fails to be processed (e.g. throws an exception),
10  * the pool must call connection's destroy method and then removes it from its list.
11  *
12  * Connection pools are not allowed to process destroyed connections but may add or return them
13  * in appropriate methods.
14  *
15  * This class must be aware of core's POISONED status. When core is poisoned it is the
16  * responsibility of a connection pool to poison all connections in it, so they will die
17  * soon and server will shut down.
18  *
19  *
20  * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
21  */

22 public interface ConnectionPool {
23
24   /** Add a connection to the pool
25    * @param connection Connection
26    */

27   public void add(Connection connection);
28
29
30   /** Remove a connection from the pool
31    * @param connection Connection
32    */

33   public void remove(Connection connection);
34
35
36   /** Pool size
37    * @return Number of connection in the pool
38    */

39   public int size();
40
41
42   /** Destroy the pool and kill all connections */
43   public void destroy();
44
45
46   /** Initialize the pool */
47   public void initialize() throws Exception JavaDoc;
48
49
50   /** List all connections (must return a copy and not the original set)
51    * @return Copy of the original set of connections
52    */

53   public Set JavaDoc<Connection> list();
54 }
55
Popular Tags