|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cxf.endpoint.AbstractConduitSelector org.apache.cxf.clustering.FailoverTargetSelector
public class FailoverTargetSelector
Implements a target selection strategy based on failover to an alternate target endpoint when a transport level failure is encountered. Note that this feature changes the conduit on the fly and thus makes the Client not thread safe.
Nested Class Summary | |
---|---|
protected class |
FailoverTargetSelector.InvocationContext
Records the context of an invocation. |
protected static class |
FailoverTargetSelector.InvocationKey
Used to wrap an Exchange for usage as a Map key. |
Field Summary | |
---|---|
protected FailoverStrategy |
failoverStrategy
|
protected ConcurrentHashMap<FailoverTargetSelector.InvocationKey,FailoverTargetSelector.InvocationContext> |
inProgress
|
Fields inherited from class org.apache.cxf.endpoint.AbstractConduitSelector |
---|
CONDUIT_COMPARE_FULL_URL, conduits, endpoint, KEEP_CONDUIT_ALIVE |
Constructor Summary | |
---|---|
FailoverTargetSelector()
Normal constructor. |
|
FailoverTargetSelector(Conduit c)
Constructor, allowing a specific conduit to override normal selection. |
Method Summary | |
---|---|
void |
complete(Exchange exchange)
Called on completion of the MEP for which the Conduit was required. |
protected void |
doComplete(Exchange exchange)
|
protected long |
getDelayBetweenRetries()
Returns delay (in milliseconds) between retries |
protected Endpoint |
getFailoverTarget(Exchange exchange,
FailoverTargetSelector.InvocationContext invocation)
Get the failover target endpoint, if a suitable one is available. |
protected FailoverTargetSelector.InvocationContext |
getInvocationContext(FailoverTargetSelector.InvocationKey key)
|
protected Logger |
getLogger()
|
FailoverStrategy |
getStrategy()
|
boolean |
isSupportNotAvailableErrorsOnly()
|
protected void |
onFailure(FailoverTargetSelector.InvocationContext context)
|
protected void |
onSuccess(FailoverTargetSelector.InvocationContext context)
|
protected void |
overrideAddressProperty(Map<String,Object> context)
Override the ENDPOINT_ADDRESS property in the request context |
protected void |
overrideAddressProperty(Map<String,Object> context,
String address)
|
protected boolean |
performFailover(Exchange exchange,
FailoverTargetSelector.InvocationContext invocation)
|
void |
prepare(Message message)
Called prior to the interceptor chain being traversed. |
protected boolean |
replaceEndpointAddressPropertyIfNeeded(Message message,
String endpointAddress,
Conduit cond)
|
protected boolean |
requiresFailover(Exchange exchange)
Check if the exchange is suitable for a failover. |
Conduit |
selectConduit(Message message)
Called when a Conduit is actually required. |
protected void |
setOriginalEndpoint(FailoverTargetSelector.InvocationContext invocation)
|
void |
setStrategy(FailoverStrategy strategy)
|
void |
setSupportNotAvailableErrorsOnly(boolean support)
|
protected void |
setupExchangeExceptionProperties(Exchange ex)
|
Methods inherited from class org.apache.cxf.endpoint.AbstractConduitSelector |
---|
close, createConduit, findCompatibleConduit, getEndpoint, getSelectedConduit, removeConduit, setEndpoint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ConcurrentHashMap<FailoverTargetSelector.InvocationKey,FailoverTargetSelector.InvocationContext> inProgress
protected FailoverStrategy failoverStrategy
Constructor Detail |
---|
public FailoverTargetSelector()
public FailoverTargetSelector(Conduit c)
c
- specific conduitMethod Detail |
---|
public void prepare(Message message)
message
- the current Messageprotected void setupExchangeExceptionProperties(Exchange ex)
public Conduit selectConduit(Message message)
message
-
protected FailoverTargetSelector.InvocationContext getInvocationContext(FailoverTargetSelector.InvocationKey key)
public void complete(Exchange exchange)
complete
in interface ConduitSelector
complete
in class AbstractConduitSelector
exchange
- represents the completed MEPprotected void doComplete(Exchange exchange)
protected void setOriginalEndpoint(FailoverTargetSelector.InvocationContext invocation)
protected boolean performFailover(Exchange exchange, FailoverTargetSelector.InvocationContext invocation)
protected void onSuccess(FailoverTargetSelector.InvocationContext context)
protected void onFailure(FailoverTargetSelector.InvocationContext context)
public void setStrategy(FailoverStrategy strategy)
strategy
- the FailoverStrategy to usepublic FailoverStrategy getStrategy()
protected Logger getLogger()
getLogger
in class AbstractConduitSelector
protected long getDelayBetweenRetries()
protected boolean requiresFailover(Exchange exchange)
exchange
- the current Exchange
protected Endpoint getFailoverTarget(Exchange exchange, FailoverTargetSelector.InvocationContext invocation)
exchange
- the current Exchangeinvocation
- the current InvocationContext
protected void overrideAddressProperty(Map<String,Object> context)
context
- the request contextprotected void overrideAddressProperty(Map<String,Object> context, String address)
protected boolean replaceEndpointAddressPropertyIfNeeded(Message message, String endpointAddress, Conduit cond)
replaceEndpointAddressPropertyIfNeeded
in class AbstractConduitSelector
public boolean isSupportNotAvailableErrorsOnly()
public void setSupportNotAvailableErrorsOnly(boolean support)
|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |