View Javadoc

1   //$Id: ClientPool.java,v 1.1 2006/02/20 04:25:11 sjardine Exp $
2   //
3   //Copyright 2005 Steven Jardine <steve@mjnservices.com>
4   //Copyright 2005 MJN Services, Inc - http://www.mjnservices.com
5   //
6   //for information on the HylaFAX FAX server see
7   //http://www.hylafax.org/
8   //
9   //This library is free software; you can redistribute it and/or
10  //modify it under the terms of the GNU Library General Public
11  //License as published by the Free Software Foundation; either
12  //version 2 of the License, or (at your option) any later version.
13  //
14  //This library is distributed in the hope that it will be useful,
15  //but WITHOUT ANY WARRANTY; without even the implied warranty of
16  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  //Library General Public License for more details.
18  //
19  //You should have received a copy of the GNU Library General Public
20  //License along with this library; if not, write to the Free
21  //Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  //
23  
24  package gnu.hylafax;
25  
26  import gnu.hylafax.pool.ClientPoolException;
27  
28  /***
29   * @author <a href="mailto:steve@mjnservices.com">Steven Jardine </a>
30   */
31  public interface ClientPool {
32  
33      /***
34       * Retrieve a client from the client pool. If the pool is empty or all
35       * connections are being used this function will block for
36       * <code>blockingTimeout</code> milli-seconds and then throw an exception.
37       * 
38       * @return A client from the client pool.
39       */
40      public Client getClient() throws ClientPoolException;
41  
42      /***
43       * Get the username that has been designated for use in creating client
44       * connections.
45       * 
46       * @return the username being used to connect to the client pool.
47       */
48      public String getUserName() throws ClientPoolException;
49  
50      /***
51       * Sets the username to be used to connect clients to the server.
52       * 
53       * @param userName
54       *            The usename to be used for client connections.
55       */
56      public void setUserName(String userName) throws ClientPoolException;
57  
58      /***
59       * Sets the password to be used to connect clients to the server. If the
60       * password is "" or <code>null</code> it will not be used to connect.
61       * 
62       * @param password
63       */
64      public void setPassword(String password) throws ClientPoolException;
65  
66      /***
67       * @return the number of milli-seconds the pool will wait for an available
68       *         connection prior to throwing an exception.
69       */
70      public long getBlockingTimeout() throws ClientPoolException;
71  
72      /***
73       * Sets the number of milli-seconds to wait for an available connection.
74       * 
75       * @param blockingTimeout
76       *            the number of milli-seconds the pool will wait for an
77       *            available connection prior to throwing an exception.
78       */
79      public void setBlockingTimeout(long blockingTimeout)
80              throws ClientPoolException;
81  
82      /***
83       * @return the maximum number of clients allowed by the client pool.
84       */
85      public int getMaxPoolSize() throws ClientPoolException;
86  
87      /***
88       * Sets the maximum number of clients allowed by the client pool.
89       * 
90       * @param maxPoolSize
91       */
92      public void setMaxPoolSize(int maxPoolSize) throws ClientPoolException;
93  
94      /***
95       * @return the minimum number of clients in the pool.
96       */
97      public int getMinPoolSize() throws ClientPoolException;
98  
99      /***
100      * Sets the minimum number of clients to initialize the pool with.
101      * 
102      * @param minPoolSize
103      */
104     public void setMinPoolSize(int minPoolSize) throws ClientPoolException;
105 
106     /***
107      * @return the number of milli-seconds of client inactivity before sending a
108      *         noop command.
109      */
110     public long getNoopInterval() throws ClientPoolException;
111 
112     /***
113      * Sets the number of milli-seconds of client inactivity before sending a
114      * noop command to the server.
115      * 
116      * @param noopInterval
117      */
118     public void setNoopInterval(long noopInterval) throws ClientPoolException;
119 
120 }