Class ClientPoolImpl<C,​E extends java.lang.Exception>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ClientPool<C,​E>
    Direct Known Subclasses:
    HiveClientPool, JdbcClientPool

    public abstract class ClientPoolImpl<C,​E extends java.lang.Exception>
    extends java.lang.Object
    implements java.io.Closeable, ClientPool<C,​E>
    • Constructor Detail

      • ClientPoolImpl

        public ClientPoolImpl​(int poolSize,
                              java.lang.Class<? extends E> reconnectExc,
                              boolean retryByDefault)
    • Method Detail

      • run

        public <R> R run​(ClientPool.Action<R,​C,​E> action)
                  throws E extends java.lang.Exception,
                         java.lang.InterruptedException
        Specified by:
        run in interface ClientPool<C,​E extends java.lang.Exception>
        Throws:
        E extends java.lang.Exception
        java.lang.InterruptedException
      • run

        public <R> R run​(ClientPool.Action<R,​C,​E> action,
                         boolean retry)
                  throws E extends java.lang.Exception,
                         java.lang.InterruptedException
        Specified by:
        run in interface ClientPool<C,​E extends java.lang.Exception>
        Throws:
        E extends java.lang.Exception
        java.lang.InterruptedException
      • newClient

        protected abstract C newClient()
      • reconnect

        protected abstract C reconnect​(C client)
      • isConnectionException

        protected boolean isConnectionException​(java.lang.Exception exc)
      • close

        protected abstract void close​(C client)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • poolSize

        public int poolSize()