Class Merger

java.lang.Object
net.ME1312.Galaxi.Library.Merger

public class Merger extends Object
Thread Merger Class
  • Constructor Summary

    Constructors
    Constructor
    Description
    Merger(Runnable action)
    Create a Thread Consolidator
    Merger(Thread thread)
    Create a Thread Consolidator
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Call this at the end of each thread
    void
    Call this before starting a thread
    void
    reserve(int amount)
    Call this before starting multiple threads
    int
    See how many threads are still active

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Merger

      public Merger(Runnable action)
      Create a Thread Consolidator
      Parameters:
      action - Resulting Action (this is run in the last existing thread upon completion)
    • Merger

      public Merger(Thread thread)
      Create a Thread Consolidator
      Parameters:
      thread - Resulting Thread (this is started upon completion)
  • Method Details

    • reserved

      public int reserved()
      See how many threads are still active
      Returns:
      Reservation count
    • reserve

      public void reserve()
      Call this before starting a thread
    • reserve

      public void reserve(int amount)
      Call this before starting multiple threads
      Parameters:
      amount - Amount of threads
    • release

      public void release()
      Call this at the end of each thread