Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.service.importer.support.internal.support
Class RetryTemplate

    java.lang.Object
      org.eclipse.gemini.blueprint.service.importer.support.internal.support.RetryTemplate

    public class RetryTemplate

extends Object

Wrapper retry template. This class does specialized retries using a given callback and lock.

Author:
  Costin Leau

Field Summary
`static long` | `DEFAULT_WAIT_TIME`

Constructor Summary
`RetryTemplate(long waitTime, Object notificationLock)`
`RetryTemplate(Object notificationLock)`

Method Summary
`protected void` | `callbackFailed(long stop)` Template method invoked when the retry has failed.
`protected void` | `callbackSucceeded(long stop)` Template method invoked when the retry succeeded.
`boolean` | `equals(Object other)`
`
`<T> T`
` | `execute(RetryCallback<T> callback)` Main retry method.
`long` | `getWaitTime()`
`int` | `hashCode()`
`protected void` | `onMissingTarget()` Template method invoked if the backing service is missing.
`void` | `reset(long waitTime)` Reset the retry template, by applying the new values.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_WAIT_TIME

    public static final long DEFAULT_WAIT_TIME

See Also:
  Constant Field Values

Constructor Detail

### RetryTemplate

    public RetryTemplate(long waitTime,
                         Object notificationLock)

### RetryTemplate

    public RetryTemplate(Object notificationLock)

Method Detail

### execute

    public <T> T execute(RetryCallback<T> callback)

  Main retry method. Executes the callback until it gets completed. The callback will get executed the number of `#retryNumbers` while waiting in-between for the `DEFAULT_WAIT_TIME` amount. Before bailing out, the callback will be called one more time. Thus, in case of being unsuccessful, the default value of the callback is returned.

  Parameters:
    `callback` -
  Returns:

### onMissingTarget

    protected void onMissingTarget()

  Template method invoked if the backing service is missing.

### callbackSucceeded

    protected void callbackSucceeded(long stop)

  Template method invoked when the retry succeeded.

  Parameters:
    `stop` - the time it took to execute the call (including waiting for the service)

### callbackFailed

    protected void callbackFailed(long stop)

  Template method invoked when the retry has failed.

  Parameters:
    `stop` - the time it took to execute the call (including waiting for the service)

### reset

    public void reset(long waitTime)

  Reset the retry template, by applying the new values. Any in-flight waiting is interrupted and restarted using the new values.

  Parameters:
    `retriesNumber` -
    `waitTime` -

### getWaitTime

    public long getWaitTime()

### equals

    public boolean equals(Object other)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.