public abstract class ClientPoolImpl<C,E extends java.lang.Exception> extends java.lang.Object implements java.io.Closeable, ClientPool<C,E>
ClientPool.Action<R,C,E extends java.lang.Exception>
Constructor and Description |
---|
ClientPoolImpl(int poolSize,
java.lang.Class<? extends E> reconnectExc,
boolean retryByDefault) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected abstract void |
close(C client) |
boolean |
isClosed() |
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) |
public ClientPoolImpl(int poolSize, java.lang.Class<? extends E> reconnectExc, boolean retryByDefault)
public <R> R run(ClientPool.Action<R,C,E> action) throws E extends java.lang.Exception, java.lang.InterruptedException
run
in interface ClientPool<C,E extends java.lang.Exception>
E extends java.lang.Exception
java.lang.InterruptedException
public <R> R run(ClientPool.Action<R,C,E> action, boolean retry) throws E extends java.lang.Exception, java.lang.InterruptedException
run
in interface ClientPool<C,E extends java.lang.Exception>
E extends java.lang.Exception
java.lang.InterruptedException
protected abstract C newClient()
protected boolean isConnectionException(java.lang.Exception exc)
protected abstract void close(C client)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public int poolSize()
public boolean isClosed()