Package org.jcsp.lang

Class Bucket

    • Constructor Summary

      Constructors 
      Constructor Description
      Bucket()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Bucket[] create​(int n)
      Creates an array of Buckets.
      void fallInto()
      Fall into the bucket.
      int flush()
      Flush the bucket.
      int holding()
      This returns the number of processes currently held in the bucket.
      • Methods inherited from class java.lang.Object

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

      • Bucket

        public Bucket()
    • Method Detail

      • fallInto

        public void fallInto()
        Fall into the bucket. The process doing this will be blocked until the next flush().
      • flush

        public int flush()
        Flush the bucket. All held processes will be released. It returns the number that were released.

        Returns:
        the number of processes flushed.
      • holding

        public int holding()
        This returns the number of processes currently held in the bucket. Note that this number is volatile - for information only! By the time the invoker of this method receives it, it might have changed (because of further processes falling into the bucket or someone flushing it).

        Returns:
        the number of processes currently held in the bucket.
      • create

        public static Bucket[] create​(int n)
        Creates an array of Buckets.

        Parameters:
        n - the number of Buckets to create in the array
        Returns:
        the array of Buckets