Class HttpConnFactory


  • public class HttpConnFactory
    extends java.lang.Object
    Factory for getting HTTP Connections to a HTTPO server
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger logger  
      protected int mMaxConns  
      protected int mMinConns  
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpConnFactory()
      Constructor for initializing from the config store.
      HttpConnFactory​(int minConns, int maxConns, IAuthority source, com.netscape.certsrv.connector.IRemoteAuthority dest, java.lang.String nickname, java.lang.String clientCiphers, int timeout)
      Constructor for HttpConnFactory
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.netscape.certsrv.connector.IHttpConnection getConn()
      gets a conenction from this factory.
      com.netscape.certsrv.connector.IHttpConnection getConn​(boolean waitForConn)
      Returns a Http connection - a clone of the master connection.
      void returnConn​(com.netscape.certsrv.connector.IHttpConnection conn)
      Return connection to the factory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mMinConns

        protected int mMinConns
      • mMaxConns

        protected int mMaxConns
    • Constructor Detail

      • HttpConnFactory

        public HttpConnFactory()
        Constructor for initializing from the config store. must be followed by init(IConfigStore)
      • HttpConnFactory

        public HttpConnFactory​(int minConns,
                               int maxConns,
                               IAuthority source,
                               com.netscape.certsrv.connector.IRemoteAuthority dest,
                               java.lang.String nickname,
                               java.lang.String clientCiphers,
                               int timeout)
                        throws EBaseException
        Constructor for HttpConnFactory
        Parameters:
        minConns - minimum number of connections to have available
        maxConns - max number of connections to have available. This is
        serverInfo - server connection info - host, port, etc.
        Throws:
        EBaseException
    • Method Detail

      • getConn

        public com.netscape.certsrv.connector.IHttpConnection getConn()
                                                               throws EBaseException
        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,
         IHttpConnection 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

        public com.netscape.certsrv.connector.IHttpConnection getConn​(boolean waitForConn)
                                                               throws EBaseException
        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

        public void returnConn​(com.netscape.certsrv.connector.IHttpConnection conn)
        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,
         IHttpConnection c = null;
         try {
             c = factory.getConn();
             myclass.do_something_with_c(c);
         } catch (EBaseException e) {
             handle_error_here();
         } finally {
             factory.returnConn(c);
         }