com.atlassian.greenhopper.service.lexorank
Class BackoffHandler

java.lang.Object
  extended by com.atlassian.greenhopper.service.lexorank.BackoffHandler

public class BackoffHandler
extends java.lang.Object

The backoff handler implements a backoff mechanism to relieve DB contention, where multiple threads and nodes are trying to modify the DB for the same issues.


Constructor Summary
BackoffHandler(LexoRankStatisticsAgent lexoRankStatisticsAgent, long timeoutTime)
          Create a new instance of the handler.
 
Method Summary
 void maybeWait()
          At the beginning of each retry, the DB operation must call this function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackoffHandler

public BackoffHandler(LexoRankStatisticsAgent lexoRankStatisticsAgent,
                      long timeoutTime)
Create a new instance of the handler.

Parameters:
timeoutTime - is the time when the DB operation is expected to time out.
Method Detail

maybeWait

public void maybeWait()
At the beginning of each retry, the DB operation must call this function. 1st call - NO SLEEP 2nd call - Thread.yield() only. 3rd call - sleep for 100ms-199ms (or less if timeoutTime is crossed or thread is interrupted) 4th call - sleep for 250ms-498ms (or less if timeoutTime is crossed or thread is interrupted) 5th call - sleep for 450ms-897ms (or less if timeoutTime is crossed or thread is interrupted) etc.



Copyright © 2007-2014 Atlassian. All Rights Reserved.