Package org.multiverse.api
Interface BackoffPolicy
-
- All Known Implementing Classes:
DefaultBackoffPolicy
public interface BackoffPolicy
A policy to be used whenTxn
or an atomic operation can't make any progress, e.g. because there aReadWriteConflict
. If the next attempt would be done without waiting, the contention is going to increase. It can be better to back off to give the contending Transactions some time to complete so that the chance increases that the failing Txn can complete at a next attempt. Of course when there is a lot of contention, the BackoffPolicy isn't going to help and the Txn could start to suffer from a livelock/starvation.- Author:
- Peter Veentjer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delay(int attempt)
Delays the calling Thread.void
delayUninterruptible(int attempt)
Delays the calling Thread without being interrupted.
-
-
-
Method Detail
-
delay
void delay(int attempt) throws InterruptedException
Delays the calling Thread.The implementation is free to make this a no-op call.
- Parameters:
attempt
-- Throws:
InterruptedException
-
delayUninterruptible
void delayUninterruptible(int attempt)
Delays the calling Thread without being interrupted.The implementation is free to make this a no-op call.
- Parameters:
attempt
- the
-
-