Class Page

java.lang.Object
nz.org.riskscape.engine.sched.Page

public class Page extends Object

The Scheduler works with Pages, which is simply a block of Tuples. The goal is to reduce thread-contention - each thread can work independently with its own Page of Tuples, and we only have to worry about locking when adding/getting a new Page.

  • Constructor Details

    • Page

      public Page(int pageSize)
  • Method Details

    • getTupleCount

      public int getTupleCount()
      Returns:
      the number of Tuples currently in this page
    • isFull

      public boolean isFull()
      Returns:
      true if no more Tuples can be added to this page
    • add

      public void add(nz.org.riskscape.engine.Tuple tuple)

      Adds (i.e. writes) a new tuple to the page.

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getReadOnlyCopy

      public Page.ReadOnlyPage getReadOnlyCopy()

      Returns a copy of the Page that can only be read from, not updated. Note that multiple different processes can read from the same Page at the same time.

    • getMaxSize

      public int getMaxSize()

      The maximum number of Tuples that can fit in this page