Module raytracer

Class SolverInOwnThread

java.lang.Object
de.grogra.task.Solver
de.grogra.task.SolverInOwnThread
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
LocalSolver, NonGraphLockedSolver

public abstract class SolverInOwnThread extends Solver implements Runnable
This abstract class implements Solver such that a thread is created in which the actual work is done.
Author:
Ole Kniemeyer
  • Constructor Details

    • SolverInOwnThread

      public SolverInOwnThread()
  • Method Details

    • createThread

      protected abstract Thread createThread()
      Create the thread to use. If this returns null, the solve methods operates synchronously, i.e., it immediately solves the partial task.
      Returns:
      thread to use for operation, or null in synchronous case
    • solveImpl

      protected abstract void solveImpl(PartialTask task)
      This method has to be implemented to perform the actual work.
      Parameters:
      task - task to solve
    • solve

      protected void solve()
      Description copied from class: Solver
      This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously. After the partial task has been solved, the method Task.partialTaskDone(Solver) has to be invoked.
      Specified by:
      solve in class Solver
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • dispose

      public void dispose()
      Description copied from class: Solver
      This method is invoked by the Task when this solver is removed from the task. Subclasses have to implement this method in order to free resources (e.g., created threads).
      Specified by:
      dispose in class Solver