question: boolean awaitExchange ( E e , int start ) { for ( int step = 0 , totalSpins = 0 ; ( step < ARENA_LENGTH ) && ( totalSpins < SPINS ) ; step ++ ) { int index = ( start + step ) & ARENA_MASK ; AtomicReference < Object > slot = arena [ index ] ; Object found = slot . get ( ) ; if ( ( found == WAITER ) && slot . compareAndSet ( WAITER , e ) ) { return true ; } else if ( ( found == FREE ) && slot . compareAndSet ( FREE , e ) ) { int slotSpins = 0 ; for ( ; ; ) { found = slot . get ( ) ; if ( found != e ) { return true ; } else if ( ( slotSpins >= SPINS_PER_STEP ) && ( slot . compareAndSet ( e , FREE ) ) ) { totalSpins += slotSpins ; break ; } slotSpins ++ ; } } } return false ; }
target:  Waits for (by spinning) to have the element transfered to another thread. The element is filled into an empty slot in the arena and spun on until it is transfered or a per-slot spin limit is reached. This search and wait strategy is repeated by selecting another slot until a total spin limit is reached.