Class FIFOMessageQueue<K,​V>


  • public class FIFOMessageQueue<K,​V>
    extends java.lang.Object
    Blocking queue which can only process 1 message per service concurrently, establishing FIFO order per sender. Example: if message A1, A2, A3, B1, B2 (where A and B are service names for services on top of a Multiplexer) arrive at the same time, then this class will deliver A1 and B1 concurrently (ie. pass them up to the thread pool for processing). Only when A1 is done will A2 be processed, same for B2: it will get processed when B1 is done. Thus, messages for different services are processed concurrently; messages from the same service are processed FIFO.
    Version:
    $Id: FIFOMessageQueue.java,v 1.8 2007/06/29 10:57:40 belaban Exp $
    Author:
    Bela Ban
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void done​(Address sender, K dest)  
      V poll​(long timeout)  
      void put​(Address sender, K dest, V el)  
      int size()  
      V take()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FIFOMessageQueue

        public FIFOMessageQueue()
    • Method Detail

      • take

        public V take()
               throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • poll

        public V poll​(long timeout)
               throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • put

        public void put​(Address sender,
                        K dest,
                        V el)
                 throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • done

        public void done​(Address sender,
                         K dest)
      • size

        public int size()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object