Package org.apache.camel.support.cache
Class DefaultProducerCache
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.cache.DefaultProducerCache
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.ProducerCache,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
- Direct Known Subclasses:
EmptyProducerCache
public class DefaultProducerCache extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.ProducerCacheDefault implementation ofProducerCache.
-
-
Constructor Summary
Constructors Constructor Description DefaultProducerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.camel.AsyncProduceracquireProducer(org.apache.camel.Endpoint endpoint)protected booleanasyncDispatchExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)CompletableFuture<org.apache.camel.Exchange>asyncSend(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, CompletableFuture<org.apache.camel.Exchange> future)Deprecated.CompletableFuture<org.apache.camel.Exchange>asyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.Exchange> future)voidcleanUp()protected ProducerServicePoolcreateServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)protected CompletableFuture<org.apache.camel.Exchange>doAsyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.Exchange> f)protected voiddoBuild()booleandoInAsyncProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, org.apache.camel.spi.ProducerCache.AsyncProducerCallback producerCallback)protected voiddoInit()protected voiddoShutdown()protected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextgetCamelContext()intgetCapacity()org.apache.camel.spi.EndpointUtilizationStatisticsgetEndpointUtilizationStatistics()ObjectgetSource()booleanisEventNotifierEnabled()booleanisExtendedStatistics()voidpurge()voidreleaseProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer)org.apache.camel.Exchangesend(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.Processor resultProcessor)voidsetEventNotifierEnabled(boolean eventNotifierEnabled)voidsetExtendedStatistics(boolean extendedStatistics)Whether extended JMX statistics is enabled forEndpointUtilizationStatisticsintsize()StringtoString()-
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
-
DefaultProducerCache
public DefaultProducerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
-
-
Method Detail
-
createServicePool
protected ProducerServicePool createServicePool(org.apache.camel.CamelContext camelContext, int cacheSize)
-
isEventNotifierEnabled
public boolean isEventNotifierEnabled()
- Specified by:
isEventNotifierEnabledin interfaceorg.apache.camel.spi.ProducerCache
-
setEventNotifierEnabled
public void setEventNotifierEnabled(boolean eventNotifierEnabled)
- Specified by:
setEventNotifierEnabledin interfaceorg.apache.camel.spi.ProducerCache
-
isExtendedStatistics
public boolean isExtendedStatistics()
-
setExtendedStatistics
public void setExtendedStatistics(boolean extendedStatistics)
Whether extended JMX statistics is enabled forEndpointUtilizationStatistics
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
-
getSource
public Object getSource()
- Specified by:
getSourcein interfaceorg.apache.camel.spi.ProducerCache
-
acquireProducer
public org.apache.camel.AsyncProducer acquireProducer(org.apache.camel.Endpoint endpoint)
- Specified by:
acquireProducerin interfaceorg.apache.camel.spi.ProducerCache
-
releaseProducer
public void releaseProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer)- Specified by:
releaseProducerin interfaceorg.apache.camel.spi.ProducerCache
-
send
public org.apache.camel.Exchange send(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.Processor resultProcessor)- Specified by:
sendin interfaceorg.apache.camel.spi.ProducerCache
-
asyncSend
@Deprecated public CompletableFuture<org.apache.camel.Exchange> asyncSend(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, CompletableFuture<org.apache.camel.Exchange> future)
Deprecated.Asynchronously sends an exchange to an endpoint using a suppliedProcessorto populate the exchangeThis method will neither throw an exception nor complete future exceptionally. If processing of the given Exchange failed then the exception is stored on the return Exchange
- Parameters:
endpoint- the endpoint to send the exchange topattern- the messageExchangePatternsuch asExchangePattern.InOnlyorExchangePattern.InOutprocessor- the transformer used to populate the new exchangeresultProcessor- a processor to process the exchange when the send is complete.future- the preexisting future to complete when processing is done or null if to create new one- Returns:
- future that completes with exchange when processing is done. Either passed into future parameter or new one if parameter was null
-
asyncSendExchange
public CompletableFuture<org.apache.camel.Exchange> asyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.Exchange> future)
- Specified by:
asyncSendExchangein interfaceorg.apache.camel.spi.ProducerCache
-
doAsyncSendExchange
protected CompletableFuture<org.apache.camel.Exchange> doAsyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.Exchange> f)
-
doInAsyncProducer
public boolean doInAsyncProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, org.apache.camel.spi.ProducerCache.AsyncProducerCallback producerCallback)- Specified by:
doInAsyncProducerin interfaceorg.apache.camel.spi.ProducerCache
-
asyncDispatchExchange
protected boolean asyncDispatchExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
-
doBuild
protected void doBuild() throws Exception- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
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
-
doShutdown
protected void doShutdown() throws Exception- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
size
public int size()
- Specified by:
sizein interfaceorg.apache.camel.spi.ProducerCache
-
getCapacity
public int getCapacity()
- Specified by:
getCapacityin interfaceorg.apache.camel.spi.ProducerCache
-
purge
public void purge()
- Specified by:
purgein interfaceorg.apache.camel.spi.ProducerCache
-
cleanUp
public void cleanUp()
- Specified by:
cleanUpin interfaceorg.apache.camel.spi.ProducerCache
-
getEndpointUtilizationStatistics
public org.apache.camel.spi.EndpointUtilizationStatistics getEndpointUtilizationStatistics()
- Specified by:
getEndpointUtilizationStatisticsin interfaceorg.apache.camel.spi.ProducerCache
-
-