com.atlassian.greenhopper.service.lexorank
Class LexoRankOperation

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

public class LexoRankOperation
extends java.lang.Object

Encapsulates a single rank operation in a command pattern.

A rank operation attempts to rank a row to a new rank position relative to the other rank rows.

There are 4 types of rank operations :

- Rank Before : A row is ranked to be before a target row - Rank After : A row is ranked to be after a target row - Rank First : A row is ranked to be the first row in the order - Rank Last : A row is ranked ot be the last row in the order

The rank operation's goal is to change the rank value of a row so that the lexographical order of the row's new rank value is correctly ranked relative to the target row's rank value.

A rank operation consists of following steps:

1. Find the row that is to be ranked 2. Find the rows between which the row to be ranked should be ranked. 3. Acquire a lock on those 3 rows 4. Ensure the rows involved in the rank operation haven't changed since the lock was acquired 5. Change the rank value of the row to be ranked to be in between the two other rows 6. Release the lock on all 3 rows

The algorithm will try to perform these steps until it can successfully change the rank of the row or until a timeout is reached. If one of the steps fails, the algorithm will try again beginning from the start and after it has waited a short amount of random time. This wait time is put in place to prevent race conditions with other concurrent operations trying to perform an operation on the same rows.


Nested Class Summary
static class LexoRankOperation.Builder
           
static interface LexoRankOperation.CompleteRankOperation
           
static interface LexoRankOperation.ForRankField
           
static interface LexoRankOperation.HowToRankIssue
           
static interface LexoRankOperation.IssueToRank
           
static class LexoRankOperation.RankOperationType
           
 
Method Summary
static LexoRankOperation.IssueToRank builder(LexoRankDao lexoRankDao, LexoRankStatisticsAgent lexoRankStatisticsAgent)
           
 LexoRankOperationOutcome<LexoRankChange> execute()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

execute

public LexoRankOperationOutcome<LexoRankChange> execute()

builder

public static LexoRankOperation.IssueToRank builder(LexoRankDao lexoRankDao,
                                                    LexoRankStatisticsAgent lexoRankStatisticsAgent)


Copyright © 2007-2014 Atlassian. All Rights Reserved.