org.objectweb.dream.queue
Class AbstractPullOutgoingHandlerImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.queue.AbstractPullOutgoingHandlerImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, Pull, PullQueueAttributeController
Direct Known Subclasses:
PullOutgoingHandlerImpl

public abstract class AbstractPullOutgoingHandlerImpl
extends AbstractComponent
implements Pull, PullQueueAttributeController

Abstract implementation of a Pull outgoing handler. It implements overflow policies as defined in PullQueueAttributeController. Moreover, it implements the pull method: it checks for available message and then applies appropriate policy.

Pull incoming handler developers can inherit this class. They must implement two methods:


Field Summary
protected  boolean blockingPull
           
protected  Buffer bufferItf
           
protected  BufferRemoveFirstLast bufferRemoveFirstLastItf
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.Pull
IN_PULL_ITF_NAME, OUT_PULL_ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractPullOutgoingHandlerImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
protected abstract  Message doPull()
          Pulls a message from the buffer (i.e. get or remove).
 boolean getBlockingPull()
          Returns the blocking pull policy.
protected abstract  boolean hasAvailableMessage()
          Checks whether there is an available message.
 String[] listFc()
           
 Message pull(Map context)
           
 void setBlockingPull(boolean blockingPull)
          Sets the blocking pull policy.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockingPull

protected boolean blockingPull

bufferItf

protected Buffer bufferItf

bufferRemoveFirstLastItf

protected BufferRemoveFirstLast bufferRemoveFirstLastItf
Constructor Detail

AbstractPullOutgoingHandlerImpl

public AbstractPullOutgoingHandlerImpl()
Method Detail

pull

public Message pull(Map context)
             throws PullException
Specified by:
pull in interface Pull
Throws:
PullException
See Also:
Pull.pull(java.util.Map)

hasAvailableMessage

protected abstract boolean hasAvailableMessage()
Checks whether there is an available message.

Returns:
true if there is an available message.

doPull

protected abstract Message doPull()
                           throws InterruptedException
Pulls a message from the buffer (i.e. get or remove). This method should not check if there is a message available provided it has already been done.

Returns:
a message.
Throws:
InterruptedException - if it is interrupted while waiting an available message.

setBlockingPull

public void setBlockingPull(boolean blockingPull)
Description copied from interface: PullQueueAttributeController
Sets the blocking pull policy.

Specified by:
setBlockingPull in interface PullQueueAttributeController
Parameters:
blockingPull - the blocking pull policy.
See Also:
PullQueueAttributeController.setBlockingPull(boolean)

getBlockingPull

public boolean getBlockingPull()
Description copied from interface: PullQueueAttributeController
Returns the blocking pull policy.

Specified by:
getBlockingPull in interface PullQueueAttributeController
Returns:
the blocking pull policy.
See Also:
PullQueueAttributeController.getBlockingPull()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.