public class ServicePool<S extends org.apache.camel.Service> extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.NonManagedService
Constructor and Description |
---|
ServicePool(org.apache.camel.util.function.ThrowingFunction<org.apache.camel.Endpoint,S,Exception> producer,
Function<S,org.apache.camel.Endpoint> getEndpoint,
int capacity) |
Modifier and Type | Method and Description |
---|---|
S |
acquire(org.apache.camel.Endpoint endpoint)
Tries to acquire the service with the given key
|
void |
cleanUp() |
protected void |
doStart() |
protected void |
doStop() |
long |
getEvicted() |
long |
getHits() |
int |
getMaxCacheSize() |
long |
getMisses() |
protected org.apache.camel.impl.ServicePool.Pool<S> |
getPool(org.apache.camel.Endpoint endpoint) |
protected void |
onEvict(S s) |
void |
release(org.apache.camel.Endpoint endpoint,
S s)
Releases the service back to the pool
|
void |
resetStatistics() |
int |
size()
Returns the current size of the pool
|
doInit, doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public ServicePool(org.apache.camel.util.function.ThrowingFunction<org.apache.camel.Endpoint,S,Exception> producer, Function<S,org.apache.camel.Endpoint> getEndpoint, int capacity)
public S acquire(org.apache.camel.Endpoint endpoint) throws Exception
endpoint
- the endpointException
public void release(org.apache.camel.Endpoint endpoint, S s)
endpoint
- the endpoints
- the serviceprotected org.apache.camel.impl.ServicePool.Pool<S> getPool(org.apache.camel.Endpoint endpoint)
public int size()
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.service.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.service.ServiceSupport
Exception
public void cleanUp()
public void resetStatistics()
public long getEvicted()
public long getMisses()
public long getHits()
public int getMaxCacheSize()
Apache Camel