Package org.apache.camel.impl.engine
Class DefaultConsumerCache
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.impl.engine.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.ConsumerCacheCache 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.PollingConsumeracquirePollingConsumer(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.voidcleanUp()protected PollingConsumerServicePoolcreateServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)protected voiddoInit()protected voiddoShutdown()protected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextgetCamelContext()intgetCapacity()Gets the maximum cache size (capacity).org.apache.camel.spi.EndpointUtilizationStatisticsgetEndpointUtilizationStatistics()ObjectgetSource()Gets the source which uses this cachebooleanisExtendedStatistics()voidpurge()Purges this cacheorg.apache.camel.Exchangereceive(org.apache.camel.Endpoint endpoint)org.apache.camel.Exchangereceive(org.apache.camel.Endpoint endpoint, long timeout)org.apache.camel.ExchangereceiveNoWait(org.apache.camel.Endpoint endpoint)voidreleasePollingConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.PollingConsumer pollingConsumer)Releases an acquired producer back after usage.voidsetExtendedStatistics(boolean extendedStatistics)Whether extended JMX statistics is enabled forEndpointUtilizationStatisticsintsize()Returns the current size of the cacheStringtoString()-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, 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:
releasePollingConsumerin 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:
acquirePollingConsumerin 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:
receivein interfaceorg.apache.camel.spi.ConsumerCache
-
receive
public org.apache.camel.Exchange receive(org.apache.camel.Endpoint endpoint, long timeout)- Specified by:
receivein interfaceorg.apache.camel.spi.ConsumerCache
-
receiveNoWait
public org.apache.camel.Exchange receiveNoWait(org.apache.camel.Endpoint endpoint)
- Specified by:
receiveNoWaitin 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:
getSourcein interfaceorg.apache.camel.spi.ConsumerCache- Returns:
- the source
-
getCapacity
public int getCapacity()
Gets the maximum cache size (capacity).- Specified by:
getCapacityin interfaceorg.apache.camel.spi.ConsumerCache- Returns:
- the capacity
-
size
public int size()
Returns the current size of the cache- Specified by:
sizein interfaceorg.apache.camel.spi.ConsumerCache- Returns:
- the current size
-
purge
public void purge()
Purges this cache- Specified by:
purgein interfaceorg.apache.camel.spi.ConsumerCache
-
cleanUp
public void cleanUp()
- Specified by:
cleanUpin interfaceorg.apache.camel.spi.ConsumerCache
-
getEndpointUtilizationStatistics
public org.apache.camel.spi.EndpointUtilizationStatistics getEndpointUtilizationStatistics()
- Specified by:
getEndpointUtilizationStatisticsin interfaceorg.apache.camel.spi.ConsumerCache
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-