public abstract class ExceptionRetryHandler extends Object implements RetryHandler
ExceptionRetryHandler
retries the behaviour defined in abstract method
operation()
implemented in a concrete subclass when nominated subclasses of Exception
are thrown. The intervals between retries are defined by a RetrySchedule
.
Concrete subclasses are proxies that forward work via the operation()
to a delegate
instance for which retry behaviour is required. Both the proxy and the delegate implement the
same interfaces.
The method stubs required to perform the proxy call via operation()
may be generated by many means,
including explicit code, a DynamicProxy
and compile time aspect injection.
RetryingContext
Constructor and Description |
---|
ExceptionRetryHandler(Class<?>[] exceptionClasses,
ExceptionRetryingProxy proxy,
RetrySchedule schedule,
int maxRetries)
Creates a new instance of ExceptionRetryHandler.
|
Modifier and Type | Method and Description |
---|---|
long |
getRetryInterval(int retryCount) |
abstract Object |
operation()
Encapsulates desired behaviour
|
Object |
perform() |
void |
postFailure(Exception ex,
int retryCount)
A hook invoked each time an operation fails if a retry is scheduled
|
public ExceptionRetryHandler(Class<?>[] exceptionClasses, ExceptionRetryingProxy proxy, RetrySchedule schedule, int maxRetries)
exceptionClasses
- proxy
- maxRetries
- public Object perform() throws Exception
perform
in interface RetryHandler
Exception
org.apache.james.user.ldap.api.RetryHandler#perform()
public void postFailure(Exception ex, int retryCount)
RetryHandler
postFailure
in interface RetryHandler
ex
- The Exception
thrown when the operation was invokedretryCount
- The number of timesorg.apache.james.user.ldap.api.RetryHandler#postFailure(javax.naming.NamingException, int)
public abstract Object operation() throws Exception
RetryHandler
operation
in interface RetryHandler
Exception
org.apache.james.user.ldap.api.RetryHandler#operation()
public long getRetryInterval(int retryCount)
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.