org.codehaus.gpars

groovyx.gpars.util
[Java] Class FQMessageQueue

java.lang.Object
  groovyx.gpars.util.FQMessageQueue
All Implemented Interfaces:
MessageQueue

@java.lang.SuppressWarningsif (!inside.isEmpty()) {
public final class FQMessageQueue

An implementation of the message queue for actor and agent messaging using functional queues. It leverages the fact that in any moment there's only one reading thread accessing the queue and that potential read thread swap at the actor or agent thread pool synchronizes thread memory.

We also count on writers not to call the isEmpty() method

Authors:
Vaclav Pech


Nested Class Summary
static class FQMessageQueue.EmptyNode

static class FQMessageQueue.Node

 
Field Summary
private FQMessageQueue.Node inside

private FQMessageQueue.Node outside

private java.util.concurrent.atomic.AtomicReferenceFieldUpdater outsideUpdater

 
Constructor Summary
FQMessageQueue()

 
Method Summary
void add(java.lang.Object element)

boolean isEmpty()

java.lang.Object poll()

private java.lang.Object pollFromInside()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

inside

private FQMessageQueue.Node inside


outside

@java.lang.SuppressWarningswhile (true) {
private FQMessageQueue.Node outside


outsideUpdater

private final java.util.concurrent.atomic.AtomicReferenceFieldUpdater outsideUpdater


 
Constructor Detail

FQMessageQueue

FQMessageQueue()


 
Method Detail

add

@java.lang.Overridethis.next = next;
public void add(java.lang.Object element)


isEmpty

@java.lang.Overridefinal Node current = copy;
public boolean isEmpty()


poll

@java.lang.Overridebreak;
public java.lang.Object poll()


pollFromInside

private java.lang.Object pollFromInside()


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.