com.lmax.disruptor.util
Class Util

java.lang.Object
  extended by com.lmax.disruptor.util.Util

public final class Util
extends java.lang.Object

Set of common functions used by the Disruptor


Constructor Summary
Util()
           
 
Method Summary
static int ceilingNextPowerOfTwo(int x)
          Calculate the next power of 2, greater than or equal to x.
static long getMinimumSequence(Sequence[] sequences)
          Get the minimum sequence from an array of Sequences.
static Sequence[] getSequencesFor(EventProcessor... processors)
          Get an array of Sequences for the passed EventProcessors
static sun.misc.Unsafe getUnsafe()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

ceilingNextPowerOfTwo

public static int ceilingNextPowerOfTwo(int x)
Calculate the next power of 2, greater than or equal to x.

From Hacker's Delight, Chapter 3, Harry S. Warren Jr.

Parameters:
x - Value to round up
Returns:
The next power of 2 from x inclusive

getMinimumSequence

public static long getMinimumSequence(Sequence[] sequences)
Get the minimum sequence from an array of Sequences.

Parameters:
sequences - to compare.
Returns:
the minimum sequence found or Long.MAX_VALUE if the array is empty.

getSequencesFor

public static Sequence[] getSequencesFor(EventProcessor... processors)
Get an array of Sequences for the passed EventProcessors

Parameters:
processors - for which to get the sequences
Returns:
the array of Sequences

getUnsafe

public static sun.misc.Unsafe getUnsafe()


Copyright © 2011 LMAX Ltd. All Rights Reserved.