org.objectweb.proactive.core.process
Class AbstractExternalProcessDecorator.CompositeMessageSink

java.lang.Object
  |
  +--org.objectweb.proactive.core.process.AbstractExternalProcessDecorator.CompositeMessageSink
All Implemented Interfaces:
MessageSink
Enclosing class:
AbstractExternalProcessDecorator

public static class AbstractExternalProcessDecorator.CompositeMessageSink
extends java.lang.Object
implements MessageSink

Implementation of a MessageSink that can receive one message at a time


Constructor Summary
AbstractExternalProcessDecorator.CompositeMessageSink(MessageSink messageSink1, MessageSink messageSink2)
           
 
Method Summary
 java.lang.String getMessage()
          Returns a new message.
 boolean hasMessage()
          Returns true is and only if a message is ready to be consumed (the call to getMessage() won't block).
 boolean isActive()
          Returns true is and only if messages are still expected to be produced.
 void setMessage(java.lang.String messageToPost)
          Set a new message to be consumed be getMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractExternalProcessDecorator.CompositeMessageSink

public AbstractExternalProcessDecorator.CompositeMessageSink(MessageSink messageSink1,
                                                             MessageSink messageSink2)
Method Detail

getMessage

public java.lang.String getMessage()
Description copied from interface: MessageSink
Returns a new message. The method should block until a message is ready. null is returned when no more messages are to be produced.

Specified by:
getMessage in interface MessageSink
Returns:
the new message

setMessage

public void setMessage(java.lang.String messageToPost)
Description copied from interface: MessageSink
Set a new message to be consumed be getMessage. The method may block if one or several message(s) have been set before and not yet consumed. This is up to the implementation. Setting a null message is the signal that no more message will be produced.

Specified by:
setMessage in interface MessageSink
Parameters:
messageToPost - the message to be consumed or null to signal the end of the production

hasMessage

public boolean hasMessage()
Description copied from interface: MessageSink
Returns true is and only if a message is ready to be consumed (the call to getMessage() won't block). If several threads share this ressource, there is a clear race condition on the consumption of the message.

Specified by:
hasMessage in interface MessageSink
Returns:
true is and only if a message is ready to be consumed

isActive

public boolean isActive()
Description copied from interface: MessageSink
Returns true is and only if messages are still expected to be produced. It is false after a setMessage is done with a null message.

Specified by:
isActive in interface MessageSink
Returns:
true is and only if messages are still expected to be produced


Copyright © April 2004 INRIA All Rights Reserved.