Package org.apache.cxf.clustering
Class AbstractStaticFailoverStrategy
java.lang.Object
org.apache.cxf.clustering.AbstractStaticFailoverStrategy
- All Implemented Interfaces:
FailoverStrategy
- Direct Known Subclasses:
RandomStrategy,SequentialStrategy
Failover strategy based on a static cluster represented by
multiple endpoints associated with the same service instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlternateAddresses(org.apache.cxf.message.Exchange exchange) Get the alternate addresses for this invocation.List<org.apache.cxf.endpoint.Endpoint>getAlternateEndpoints(org.apache.cxf.message.Exchange exchange) Get the alternate endpoints for this invocation.longprotected List<org.apache.cxf.endpoint.Endpoint>getEndpoints(org.apache.cxf.message.Exchange exchange, boolean acceptCandidatesWithSameAddress) Get the endpoints for this invocation.protected LevelGet the log level for reporting the selection of the new alternative address or endpointprotected abstract <T> TgetNextAlternate(List<T> alternates) Get next alternate endpoint.selectAlternateAddress(List<String> alternates) Select one of the alternate addresses for a retried invocation.org.apache.cxf.endpoint.EndpointselectAlternateEndpoint(List<org.apache.cxf.endpoint.Endpoint> alternates) Select one of the alternate endpoints for a retried invocation.voidsetAlternateAddresses(List<String> alternateAddresses) voidsetDelayBetweenRetries(long delay)
-
Constructor Details
-
AbstractStaticFailoverStrategy
public AbstractStaticFailoverStrategy()
-
-
Method Details
-
setDelayBetweenRetries
public void setDelayBetweenRetries(long delay) -
getDelayBetweenRetries
public long getDelayBetweenRetries() -
setAlternateAddresses
-
getAlternateAddresses
Get the alternate addresses for this invocation.- Specified by:
getAlternateAddressesin interfaceFailoverStrategy- Parameters:
exchange- the current Exchange- Returns:
- a List of alternate addresses if available
-
selectAlternateAddress
Select one of the alternate addresses for a retried invocation.- Specified by:
selectAlternateAddressin interfaceFailoverStrategy- Parameters:
alternates- a List of alternate addresses if available- Returns:
- the selected address or
nullif no alternate address is available
-
getAlternateEndpoints
public List<org.apache.cxf.endpoint.Endpoint> getAlternateEndpoints(org.apache.cxf.message.Exchange exchange) Get the alternate endpoints for this invocation.- Specified by:
getAlternateEndpointsin interfaceFailoverStrategy- Parameters:
exchange- the current Exchange- Returns:
- a List of alternate endpoints if available
-
selectAlternateEndpoint
public org.apache.cxf.endpoint.Endpoint selectAlternateEndpoint(List<org.apache.cxf.endpoint.Endpoint> alternates) Select one of the alternate endpoints for a retried invocation.- Specified by:
selectAlternateEndpointin interfaceFailoverStrategy- Parameters:
alternates- a List of alternate endpoints if available- Returns:
- the selected endpoint or
nullif no alternate endpoint is available
-
getEndpoints
protected List<org.apache.cxf.endpoint.Endpoint> getEndpoints(org.apache.cxf.message.Exchange exchange, boolean acceptCandidatesWithSameAddress) Get the endpoints for this invocation.- Parameters:
exchange- the current ExchangeacceptCandidatesWithSameAddress- true to accept candidates with the same address- Returns:
- a List of alternate endpoints if available
-
getNextAlternate
Get next alternate endpoint.- Parameters:
alternates- non-empty List of alternate endpoints- Returns:
-
getLogLevel
Get the log level for reporting the selection of the new alternative address or endpoint- Returns:
- the log level
-