Package org.apache.camel.support.cache
Class DefaultConsumerCache
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.cache.DefaultConsumerCache
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.ConsumerCache
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
public class DefaultConsumerCache extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.ConsumerCache
Cache containing createdConsumer
.
-
-
Constructor Summary
Constructors Constructor Description DefaultConsumerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.PollingConsumer
acquirePollingConsumer(org.apache.camel.Endpoint endpoint)
Acquires a pooled PollingConsumer which you must release back again after usage using thereleasePollingConsumer(org.apache.camel.Endpoint, org.apache.camel.PollingConsumer)
method.void
cleanUp()
protected PollingConsumerServicePool
createServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)
protected void
doBuild()
protected void
doInit()
protected void
doShutdown()
protected void
doStart()
protected void
doStop()
org.apache.camel.CamelContext
getCamelContext()
int
getCapacity()
Gets the maximum cache size (capacity).org.apache.camel.spi.EndpointUtilizationStatistics
getEndpointUtilizationStatistics()
Object
getSource()
Gets the source which uses this cacheboolean
isExtendedStatistics()
void
purge()
Purges this cacheorg.apache.camel.Exchange
receive(org.apache.camel.Endpoint endpoint)
org.apache.camel.Exchange
receive(org.apache.camel.Endpoint endpoint, long timeout)
org.apache.camel.Exchange
receiveNoWait(org.apache.camel.Endpoint endpoint)
void
releasePollingConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.PollingConsumer pollingConsumer)
Releases an acquired producer back after usage.void
setExtendedStatistics(boolean extendedStatistics)
Whether extended JMX statistics is enabled forEndpointUtilizationStatistics
int
size()
Returns the current size of the cacheString
toString()
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
DefaultConsumerCache
public DefaultConsumerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
-
-
Method Detail
-
createServicePool
protected PollingConsumerServicePool createServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)
-
isExtendedStatistics
public boolean isExtendedStatistics()
-
setExtendedStatistics
public void setExtendedStatistics(boolean extendedStatistics)
Whether extended JMX statistics is enabled forEndpointUtilizationStatistics
-
releasePollingConsumer
public void releasePollingConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.PollingConsumer pollingConsumer)
Releases an acquired producer back after usage.- Specified by:
releasePollingConsumer
in interfaceorg.apache.camel.spi.ConsumerCache
- Parameters:
endpoint
- the endpointpollingConsumer
- the pollingConsumer to release
-
acquirePollingConsumer
public org.apache.camel.PollingConsumer acquirePollingConsumer(org.apache.camel.Endpoint endpoint)
Acquires a pooled PollingConsumer which you must release back again after usage using thereleasePollingConsumer(org.apache.camel.Endpoint, org.apache.camel.PollingConsumer)
method.- Specified by:
acquirePollingConsumer
in interfaceorg.apache.camel.spi.ConsumerCache
- Parameters:
endpoint
- the endpoint- Returns:
- the PollingConsumer
-
receive
public org.apache.camel.Exchange receive(org.apache.camel.Endpoint endpoint)
- Specified by:
receive
in interfaceorg.apache.camel.spi.ConsumerCache
-
receive
public org.apache.camel.Exchange receive(org.apache.camel.Endpoint endpoint, long timeout)
- Specified by:
receive
in interfaceorg.apache.camel.spi.ConsumerCache
-
receiveNoWait
public org.apache.camel.Exchange receiveNoWait(org.apache.camel.Endpoint endpoint)
- Specified by:
receiveNoWait
in interfaceorg.apache.camel.spi.ConsumerCache
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
-
getSource
public Object getSource()
Gets the source which uses this cache- Specified by:
getSource
in interfaceorg.apache.camel.spi.ConsumerCache
- Returns:
- the source
-
getCapacity
public int getCapacity()
Gets the maximum cache size (capacity).- Specified by:
getCapacity
in interfaceorg.apache.camel.spi.ConsumerCache
- Returns:
- the capacity
-
size
public int size()
Returns the current size of the cache- Specified by:
size
in interfaceorg.apache.camel.spi.ConsumerCache
- Returns:
- the current size
-
purge
public void purge()
Purges this cache- Specified by:
purge
in interfaceorg.apache.camel.spi.ConsumerCache
-
cleanUp
public void cleanUp()
- Specified by:
cleanUp
in interfaceorg.apache.camel.spi.ConsumerCache
-
getEndpointUtilizationStatistics
public org.apache.camel.spi.EndpointUtilizationStatistics getEndpointUtilizationStatistics()
- Specified by:
getEndpointUtilizationStatistics
in interfaceorg.apache.camel.spi.ConsumerCache
-
doBuild
protected void doBuild() throws Exception
- Overrides:
doBuild
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
-