org.apache.camel.processor.loadbalancer
Class CircuitBreakerLoadBalancer
java.lang.Object
org.apache.camel.support.ServiceSupport
org.apache.camel.processor.loadbalancer.LoadBalancerSupport
org.apache.camel.processor.loadbalancer.CircuitBreakerLoadBalancer
- All Implemented Interfaces:
- AsyncProcessor, CamelContextAware, Navigate<Processor>, Processor, LoadBalancer, Service, ShutdownableService, StatefulService, SuspendableService, Traceable
public class CircuitBreakerLoadBalancer
- extends LoadBalancerSupport
- implements Traceable, CamelContextAware
| Methods inherited from class org.apache.camel.support.ServiceSupport |
doResume, doSuspend, getStatus, getVersion, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
CircuitBreakerLoadBalancer
public CircuitBreakerLoadBalancer(List<Class<?>> exceptions)
CircuitBreakerLoadBalancer
public CircuitBreakerLoadBalancer()
setHalfOpenAfter
public void setHalfOpenAfter(long halfOpenAfter)
setThreshold
public void setThreshold(int threshold)
getCamelContext
public CamelContext getCamelContext()
- Description copied from interface:
CamelContextAware
- Get the
CamelContext
- Specified by:
getCamelContext in interface CamelContextAware
- Returns:
- camelContext the Camel context
setCamelContext
public void setCamelContext(CamelContext camelContext)
- Description copied from interface:
CamelContextAware
- Injects the
CamelContext
- Specified by:
setCamelContext in interface CamelContextAware
- Parameters:
camelContext - the Camel context
getExceptions
public List<Class<?>> getExceptions()
hasFailed
protected boolean hasFailed(Exchange exchange)
isRunAllowed
public boolean isRunAllowed()
- Description copied from interface:
StatefulService
- Helper methods so the service knows if it should keep running.
Returns false if the service is being stopped or is stopped.
- Specified by:
isRunAllowed in interface StatefulService- Overrides:
isRunAllowed in class ServiceSupport
- Returns:
- true if the service should continue to run.
process
public boolean process(Exchange exchange,
AsyncCallback callback)
- Description copied from interface:
AsyncProcessor
- Processes the message exchange.
Similar to
Processor.process(org.apache.camel.Exchange), but the caller supports having the exchange asynchronously processed.
If there was a failure processing then the caused Exception would be set on the Exchange.
- Specified by:
process in interface AsyncProcessor
- Parameters:
exchange - the message exchangecallback - the AsyncCallback will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.
- Returns:
- (doneSync) true to continue execute synchronously, false to continue being executed asynchronously
toString
public String toString()
- Overrides:
toString in class Object
getTraceLabel
public String getTraceLabel()
- Description copied from interface:
Traceable
- Gets the trace label used for logging when tracing is enabled.
The label should be short and precise.
- Specified by:
getTraceLabel in interface Traceable
- Returns:
- the label
Apache Camel