Package com.netscape.cmscore.connector
Class HttpConnFactory
java.lang.Object
com.netscape.cmscore.connector.HttpConnFactory
Factory for getting HTTP Connections to a HTTPO server
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for initializing from the config store.HttpConnFactory
(int minConns, int maxConns, RemoteAuthority dest, String nickname, String clientCiphers, int timeout) Constructor for HttpConnFactory -
Method Summary
Modifier and TypeMethodDescriptiongetConn()
gets a conenction from this factory.getConn
(boolean waitForConn) Returns a Http connection - a clone of the master connection.void
init()
initialize parameters obtained from either constructor or config storevoid
returnConn
(HttpConnection conn) Return connection to the factory.void
setCMSEngine
(CMSEngine engine)
-
Field Details
-
logger
public static org.slf4j.Logger logger -
engine
-
mMinConns
protected int mMinConns -
mMaxConns
protected int mMaxConns
-
-
Constructor Details
-
HttpConnFactory
public HttpConnFactory()Constructor for initializing from the config store. must be followed by init(ConfigStore) -
HttpConnFactory
public HttpConnFactory(int minConns, int maxConns, RemoteAuthority dest, String nickname, String clientCiphers, int timeout) Constructor for HttpConnFactory- Parameters:
minConns
- minimum number of connection handles to have available.maxConns
- maximum total number of connections to ever have.
-
-
Method Details
-
getCMSEngine
-
setCMSEngine
-
init
initialize parameters obtained from either constructor or config store- Throws:
EBaseException
-
getConn
gets a conenction from this factory. All connections obtained from the factory must be returned by returnConn() method. The best thing to do is to put returnConn in a finally clause so it always gets called. For example,HttpConnection c = null; try { c = factory.getConn(); myclass.do_something_with_c(c); } catch (EBaseException e) { handle_error_here(); } finally { factory.returnConn(c); }
- Throws:
EBaseException
-
getConn
Returns a Http connection - a clone of the master connection. All connections should be returned to the factory using returnConn() to recycle connection objects. If not returned the limited max number is affected but if that number is large not much harm is done. Returns null if maximum number of connections reached. The best thing to do is to put returnConn in a finally clause so it always gets called. For example,IHttpConnnection c = null; try { c = factory.getConn(); myclass.do_something_with_c(c); } catch (EBaseException e) { handle_error_here(); } finally { factory.returnConn(c); }
- Throws:
EBaseException
-
returnConn
Return connection to the factory. This is mandatory after a getConn(). The best thing to do is to put returnConn in a finally clause so it always gets called. For example,HttpConnection c = null; try { c = factory.getConn(); myclass.do_something_with_c(c); } catch (EBaseException e) { handle_error_here(); } finally { factory.returnConn(c); }
-