Class MessageSender.BlockingSet

  • All Implemented Interfaces:
    java.lang.Iterable, java.util.Collection, java.util.Set
    Enclosing class:
    MessageSender

    private static class MessageSender.BlockingSet
    extends java.util.AbstractSet
    Set implementation which dispenses its contents via an iterator which will block until all results are in.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean done_  
      private java.util.List list_  
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockingSet()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(java.lang.Object o)  
      void done()
      Indicates that no more items will be added to this set.
      java.util.Iterator iterator()  
      int size()  
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        addAll, clear, contains, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArray
    • Field Detail

      • list_

        private final java.util.List list_
      • done_

        private boolean done_
    • Constructor Detail

      • BlockingSet

        BlockingSet()
        Constructor.
    • Method Detail

      • add

        public boolean add​(java.lang.Object o)
        Specified by:
        add in interface java.util.Collection
        Specified by:
        add in interface java.util.Set
        Overrides:
        add in class java.util.AbstractCollection
      • done

        public void done()
        Indicates that no more items will be added to this set. Must be called by populator or iterator will block indefinitely.
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection
        Specified by:
        size in interface java.util.Set
        Specified by:
        size in class java.util.AbstractCollection
      • iterator

        public java.util.Iterator iterator()
        Specified by:
        iterator in interface java.util.Collection
        Specified by:
        iterator in interface java.lang.Iterable
        Specified by:
        iterator in interface java.util.Set
        Specified by:
        iterator in class java.util.AbstractCollection