com.lmax.disruptor
Class Util

java.lang.Object
  extended by com.lmax.disruptor.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(Consumer[] consumers)
          Get the minimum sequence from an array of Consumers.
 
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(Consumer[] consumers)
Get the minimum sequence from an array of Consumers.

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


Copyright © 2011 LMAX Ltd. All Rights Reserved.