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 created
Consumer.-
Field Summary
FieldsFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionDefaultConsumerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize) -
Method Summary
Modifier and TypeMethodDescriptionorg.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 voiddoBuild()protected voiddoInit()protected voidprotected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextintGets the maximum cache size (capacity).org.apache.camel.spi.EndpointUtilizationStatisticsGets the source which uses this cachebooleanvoidpurge()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 cachetoString()Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
CONTEXT_IS_STOPPED
- See Also:
-
-
Constructor Details
-
DefaultConsumerCache
public DefaultConsumerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
-
-
Method Details
-
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
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
-
toString
-
doBuild
- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-