Class Barrier


  • public class Barrier
    extends java.lang.Object
    A very simple barrier wait. Once a thread has requested a wait on the barrier with waitForRelease, it cannot fool the barrier into releasing by "hitting" the barrier multiple times-- the thread is blocked on the wait().
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int count  
      protected int threshold  
    • Constructor Summary

      Constructors 
      Constructor Description
      Barrier​(int t)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void action()
      What to do when everyone reaches barrier
      void waitForRelease()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • threshold

        protected int threshold
      • count

        protected int count
    • Constructor Detail

      • Barrier

        public Barrier​(int t)
    • Method Detail

      • waitForRelease

        public void waitForRelease()
                            throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • action

        public void action()
        What to do when everyone reaches barrier