Record Class NonCancellableTask<V>

java.lang.Object
java.lang.Record
dev.pfaff.altargui.async.NonCancellableTask<V>
All Implemented Interfaces:
Task<V>, AutoCloseable

public record NonCancellableTask<V>(Task<V> task) extends Record implements Task<V>
  • Constructor Details

    • NonCancellableTask

      public NonCancellableTask(Task<V> task)
      Creates an instance of a NonCancellableTask record class.
      Parameters:
      task - the value for the task record component
  • Method Details

    • join

      public V join() throws TaskException, InterruptedException
      Specified by:
      join in interface Task<V>
      Throws:
      TaskException
      InterruptedException
    • joinUninterruptibly

      public V joinUninterruptibly() throws TaskException
      Specified by:
      joinUninterruptibly in interface Task<V>
      Throws:
      TaskException
    • isCompleted

      public boolean isCompleted()
      Description copied from interface: Task
      If this method returns true, then Task.join() and friends are guaranteed not to block.
      Specified by:
      isCompleted in interface Task<V>
    • close

      public void close()
      Description copied from interface: Task
      "Closes" the task. If possible, this will cancel the task. If not, the method simply returns.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Task<V>
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • task

      public Task<V> task()
      Returns the value of the task record component.
      Returns:
      the value of the task record component