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.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
protected void
doStart()
protected void
doStop()
org.apache.camel.CamelContext
int
Gets the maximum cache size (capacity).org.apache.camel.spi.EndpointUtilizationStatistics
Gets the source which uses this cacheboolean
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 cachetoString()
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
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods 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:
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
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
-
toString
-
doBuild
- Overrides:
doBuild
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doInit
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doShutdown
- Overrides:
doShutdown
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-