Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server.io.buffers
Class BufferColor

java.lang.Object
  extended by org.jboss.errai.bus.server.io.buffers.BufferColor

public class BufferColor
extends Object

Defines a buffer color, which is a unique identifier for data within a TransmissionBuffer.

Author:
Mike Brock

Method Summary
static BufferColor getAllBuffersColor()
          Returns the all colors BufferColor which creates buffer data visible to all colors.
 short getColor()
           
 ReentrantLock getLock()
          Return an instance to the lock for this color.
static BufferColor getNewColor()
          Return a new unique BufferColor.
static BufferColor getNewColorFromHead(TransmissionBuffer buffer)
          Returns a new unique BufferColor set to the head sequence of the specified TransmissionBuffer.
 AtomicLong getSequence()
           
 void wake()
          Wake up all threads which are monitoring this color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getColor

public short getColor()

getSequence

public AtomicLong getSequence()

wake

public void wake()
Wake up all threads which are monitoring this color.


getLock

public ReentrantLock getLock()
Return an instance to the lock for this color.

Returns:
an instance of the ReentrantLock associated with this color. This lock is unique to, immutable and is guaranteed to always be the same lock for this color.

getNewColor

public static BufferColor getNewColor()
Return a new unique BufferColor.

Returns:
a new unique BufferColor
See Also:
getNewColorFromHead(TransmissionBuffer)

getNewColorFromHead

public static BufferColor getNewColorFromHead(TransmissionBuffer buffer)
Returns a new unique BufferColor set to the head sequence of the specified TransmissionBuffer.

Parameters:
buffer - the buffer instance to obtain the head sequence from.
Returns:
a new unique BufferColor instance.

getAllBuffersColor

public static BufferColor getAllBuffersColor()
Returns the all colors BufferColor which creates buffer data visible to all colors.

Returns:
the all colors (global) BufferColor instance.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.