Top Description Inners Fields Constructors Methods
org.springframework.util.backoff

public Class FixedBackOff

extends Object
implements BackOff
Class Inheritance
All Implemented Interfaces
org.springframework.util.backoff.BackOff

A simple BackOff implementation that provides a fixed interval between two attempts and a maximum number of retries.
Author
Stephane Nicoll
Since
4.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
public static final long
DEFAULT_INTERVAL

The default recovery interval: 5000 ms = 5 seconds.

private long
private long
public static final long
UNLIMITED_ATTEMPTS

Constant value indicating an unlimited number of attempts.

Constructor Summary

AccessConstructor and Description
public
FixedBackOff()

Create an instance with an interval of 5000 ms and an unlimited number of attempts.

public
FixedBackOff(long
the interval between two attempts
interval
,
long
the maximum number of attempts
maxAttempts
)

Create an instance.

Method Summary

Modifier and TypeMethod and Description
public long
getInterval()

Return the interval between two attempts in milliseconds.

public long
getMaxAttempts()

Return the maximum number of attempts in milliseconds.

public void
setInterval(long interval)

Set the interval between two attempts in milliseconds.

public void
setMaxAttempts(long maxAttempts)

Set the maximum number of attempts in milliseconds.

public BackOffExecution
start()

Implements org.springframework.util.backoff.BackOff.start.

Start a new back off execution.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_INTERVALback to summary
public static final long DEFAULT_INTERVAL

The default recovery interval: 5000 ms = 5 seconds.

intervalback to summary
private long interval
maxAttemptsback to summary
private long maxAttempts
UNLIMITED_ATTEMPTSback to summary
public static final long UNLIMITED_ATTEMPTS

Constant value indicating an unlimited number of attempts.

Constructor Detail

FixedBackOffback to summary
public FixedBackOff()

Create an instance with an interval of 5000 ms and an unlimited number of attempts.

FixedBackOffback to summary
public FixedBackOff(long interval, long maxAttempts)

Create an instance.

Parameters
interval:long

the interval between two attempts

maxAttempts:long

the maximum number of attempts

Method Detail

getIntervalback to summary
public long getInterval()

Return the interval between two attempts in milliseconds.

getMaxAttemptsback to summary
public long getMaxAttempts()

Return the maximum number of attempts in milliseconds.

setIntervalback to summary
public void setInterval(long interval)

Set the interval between two attempts in milliseconds.

setMaxAttemptsback to summary
public void setMaxAttempts(long maxAttempts)

Set the maximum number of attempts in milliseconds.

startback to summary
public BackOffExecution start()

Implements org.springframework.util.backoff.BackOff.start.

Doc from org.springframework.util.backoff.BackOff.start.

Start a new back off execution.

Returns:BackOffExecution

a fresh BackOffExecution ready to be used

Annotations
@Override
org.springframework.util.backoff back to summary

private Class FixedBackOff.FixedBackOffExecution

extends Object
implements BackOffExecution
Class Inheritance
  • java.lang.Object
  • org.springframework.util.backoff.FixedBackOff.FixedBackOffExecution
All Implemented Interfaces
org.springframework.util.backoff.BackOffExecution

Field Summary

Modifier and TypeField and Description
private long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public long
nextBackOff()

Implements org.springframework.util.backoff.BackOffExecution.nextBackOff.

Return the number of milliseconds to wait before retrying the operation or STOP (-1) to indicate that no further attempt should be made for the operation.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

currentAttemptsback to summary
private long currentAttempts

Constructor Detail

FixedBackOffExecutionback to summary
private FixedBackOffExecution()

Method Detail

nextBackOffback to summary
public long nextBackOff()

Implements org.springframework.util.backoff.BackOffExecution.nextBackOff.

Doc from org.springframework.util.backoff.BackOffExecution.nextBackOff.

Return the number of milliseconds to wait before retrying the operation or STOP (-1) to indicate that no further attempt should be made for the operation.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override