org.objectweb.dream.queue
Class AbstractPushQueueImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.queue.AbstractPushQueueImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, Push, PushQueueAttributeController, QueueAttributeController
Direct Known Subclasses:
BasicPushPullKeyQueueImpl, BasicPushPullQueueImpl, BasicPushPushActiveQueueImpl, BasicPushPushPassiveQueueImpl

public abstract class AbstractPushQueueImpl
extends AbstractComponent
implements Push, PushQueueAttributeController

Abstract implementation of a input push queue. It implements overflow policies as defined in PushQueueAttributeController


Field Summary
protected  int maxCapacity
           
protected  MessageManager messageManagerItf
           
protected  String overflowPolicy
           
protected  LinkedList waitingList
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.Push
IN_PUSH_ITF_NAME, OUT_PUSH_ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.PushQueueAttributeController
BLOCK_OVERFLOW_POLICY, DROP_OVERFLOW_POLICY, EXCEPTION_OVERFLOW_POLICY
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractPushQueueImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 int getCurrentSize()
          Returns the current size of the queue.
 int getMaxCapacity()
          Returns the maximum capacity of the queue.
 String getOverflowPolicy()
          Returns the overflow policy.
protected  boolean handleOverflow()
          Handle current overflow policy, and returns true if message can be put in the waiting list.
 void push(Message message, Map context)
           
 void setMaxCapacity(int maxCapacity)
          Sets the maximum capacity of the queue.
 void setOverflowPolicy(String policy)
          Sets the overflow policy.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
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
 
Methods inherited from interface org.objectweb.fractal.api.control.BindingController
listFc
 

Field Detail

messageManagerItf

protected MessageManager messageManagerItf

waitingList

protected LinkedList waitingList

maxCapacity

protected int maxCapacity

overflowPolicy

protected String overflowPolicy
Constructor Detail

AbstractPushQueueImpl

public AbstractPushQueueImpl()
Method Detail

push

public void push(Message message,
                 Map context)
          throws PushException
Specified by:
push in interface Push
Throws:
PushException
See Also:
Push.push(Message, Map)

handleOverflow

protected boolean handleOverflow()
                          throws BufferOverflowException,
                                 InterruptedPushException
Handle current overflow policy, and returns true if message can be put in the waiting list.

Returns:
true if message can be put in the waiting list.
Throws:
BufferOverflowException - thrown when overflow policy is PushQueueAttributeController.EXCEPTION_OVERFLOW_POLICY and queue is full
InterruptedPushException - thrown when overflow policy is PushQueueAttributeController.BLOCK_OVERFLOW_POLICYand the queue is full and the thread has been interrupted.

getOverflowPolicy

public String getOverflowPolicy()
Description copied from interface: PushQueueAttributeController
Returns the overflow policy.

Specified by:
getOverflowPolicy in interface PushQueueAttributeController
Returns:
the overflow policy.
See Also:
PushQueueAttributeController.getOverflowPolicy()

setOverflowPolicy

public void setOverflowPolicy(String policy)
Description copied from interface: PushQueueAttributeController
Sets the overflow policy.

Specified by:
setOverflowPolicy in interface PushQueueAttributeController
Parameters:
policy - the overflow policy.
See Also:
PushQueueAttributeController.setOverflowPolicy(String)

getCurrentSize

public int getCurrentSize()
Description copied from interface: QueueAttributeController
Returns the current size of the queue.

Specified by:
getCurrentSize in interface QueueAttributeController
Returns:
the current size of the queue.
See Also:
QueueAttributeController.getCurrentSize()

getMaxCapacity

public int getMaxCapacity()
Description copied from interface: QueueAttributeController
Returns the maximum capacity of the queue.

Specified by:
getMaxCapacity in interface QueueAttributeController
Returns:
the maximum capacity of the queue.
See Also:
QueueAttributeController.getMaxCapacity()

setMaxCapacity

public void setMaxCapacity(int maxCapacity)
Description copied from interface: QueueAttributeController
Sets the maximum capacity of the queue.

Specified by:
setMaxCapacity in interface QueueAttributeController
Parameters:
maxCapacity - the maximum capacity of the queue.
See Also:
QueueAttributeController.setMaxCapacity(int)

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)


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