org.multiverse.api
Interface BackoffPolicy

All Known Implementing Classes:
DefaultBackoffPolicy

public interface BackoffPolicy

A policy to be used when Txn or an atomic operation can't make any progress, e.g. because there a ReadWriteConflict. 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
 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


Copyright © 2012. All Rights Reserved.