Package org.apache.iceberg
Class ClientPoolImpl<C,E extends java.lang.Exception>
- java.lang.Object
-
- org.apache.iceberg.ClientPoolImpl<C,E>
-
- 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>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.iceberg.ClientPool
ClientPool.Action<R,C,E extends java.lang.Exception>
-
-
Constructor Summary
Constructors Constructor Description ClientPoolImpl(int poolSize, java.lang.Class<? extends E> reconnectExc, boolean retryByDefault)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected abstract void
close(C client)
protected boolean
isConnectionException(java.lang.Exception exc)
protected abstract C
newClient()
int
poolSize()
protected abstract C
reconnect(C client)
<R> R
run(ClientPool.Action<R,C,E> action)
<R> R
run(ClientPool.Action<R,C,E> action, boolean retry)
-
-
-
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 interfaceClientPool<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 interfaceClientPool<C,E extends java.lang.Exception>
- Throws:
E extends java.lang.Exception
java.lang.InterruptedException
-
newClient
protected abstract C newClient()
-
isConnectionException
protected boolean isConnectionException(java.lang.Exception exc)
-
close
protected abstract void close(C client)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
poolSize
public int poolSize()
-
-