public class FailoverRetrySupport<T,E extends Exception> extends Object implements FailoverSupport<T,E>
The blocking condition used is that the connection is not currently failing over, and the mutex used is the connection failover mutex, which guards against the fail-over process being run during fail-over vulnerable methods. These are used like a lock and condition variable.
The wrapped operation may throw a FailoverException, this is an exception that can be raised by a
BlockingMethodFrameListener, in response to it being notified that a
fail-over wants to start whilst it was waiting. Methods that are vulnerable to fail-over are those that are
synchronous, where a failure will prevent them from getting the reply they are waiting for and asynchronous
methods that should not be attempted when a fail-over is in progress.
Wrapping a synchronous method in a FailoverRetrySupport will have the effect that the operation will not be
started during fail-over, but be delayed until any current fail-over has completed. Should a fail-over process want
to start whilst waiting for the synchrnous reply, the FailoverRetrySupport will detect this and rety the operation
until it succeeds. Synchronous methods are usually coordinated with a
BlockingMethodFrameListener which is notified when a fail-over process wants
to start and throws a FailoverException in response to this.
Wrapping an asynchronous method in a FailoverRetrySupport will have the effect that the operation will not be started during fail-over, but be delayed until any current fail-over has completed.
TODO Another continuation. Could use an interface Continuation (as described in other todos) Then have a wrapping continuation (this), which blocks on an arbitrary Condition or Latch (specified in constructor call), that this blocks on before calling the wrapped Continuation. Must work on Java 1.4, so check retrotranslator works on Lock/Condition or latch first. Argument and return type to match wrapped condition as type parameters. Rename to AsyncConditionalContinuation or something like that.
TODO InterruptedException not handled well.
| Constructor and Description |
|---|
FailoverRetrySupport(FailoverProtectedOperation<T,E> operation,
AMQConnection con)
Creates an automatic retrying fail-over handler for the specified operation.
|
public FailoverRetrySupport(FailoverProtectedOperation<T,E> operation, AMQConnection con)
operation - The fail-over protected operation to wrap in this handler.Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.