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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields 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

    Constructors
    Constructor
    Description
    DefaultConsumerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
     
  • Method Summary

    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 the releasePollingConsumer(org.apache.camel.Endpoint, org.apache.camel.PollingConsumer) method.
    void
     
    createServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)
     
    protected void
     
    protected void
     
    protected void
     
    protected void
     
    protected void
     
    org.apache.camel.CamelContext
     
    int
    Gets the maximum cache size (capacity).
    org.apache.camel.spi.EndpointUtilizationStatistics
     
    Gets the source which uses this cache
    boolean
     
    void
    Purges this cache
    org.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 for EndpointUtilizationStatistics
    int
    Returns the current size of the cache
     

    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

  • 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 for EndpointUtilizationStatistics
    • 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 interface org.apache.camel.spi.ConsumerCache
      Parameters:
      endpoint - the endpoint
      pollingConsumer - 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 the releasePollingConsumer(org.apache.camel.Endpoint, org.apache.camel.PollingConsumer) method.
      Specified by:
      acquirePollingConsumer in interface org.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 interface org.apache.camel.spi.ConsumerCache
    • receive

      public org.apache.camel.Exchange receive(org.apache.camel.Endpoint endpoint, long timeout)
      Specified by:
      receive in interface org.apache.camel.spi.ConsumerCache
    • receiveNoWait

      public org.apache.camel.Exchange receiveNoWait(org.apache.camel.Endpoint endpoint)
      Specified by:
      receiveNoWait in interface org.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 interface org.apache.camel.spi.ConsumerCache
      Returns:
      the source
    • getCapacity

      public int getCapacity()
      Gets the maximum cache size (capacity).
      Specified by:
      getCapacity in interface org.apache.camel.spi.ConsumerCache
      Returns:
      the capacity
    • size

      public int size()
      Returns the current size of the cache
      Specified by:
      size in interface org.apache.camel.spi.ConsumerCache
      Returns:
      the current size
    • purge

      public void purge()
      Purges this cache
      Specified by:
      purge in interface org.apache.camel.spi.ConsumerCache
    • cleanUp

      public void cleanUp()
      Specified by:
      cleanUp in interface org.apache.camel.spi.ConsumerCache
    • getEndpointUtilizationStatistics

      public org.apache.camel.spi.EndpointUtilizationStatistics getEndpointUtilizationStatistics()
      Specified by:
      getEndpointUtilizationStatistics in interface org.apache.camel.spi.ConsumerCache
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • doBuild

      protected void doBuild() throws Exception
      Overrides:
      doBuild in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doShutdown

      protected void doShutdown() throws Exception
      Overrides:
      doShutdown in class org.apache.camel.support.service.BaseService
      Throws:
      Exception