Class TickingThread

java.lang.Object
com.hypixel.hytale.server.core.util.thread.TickingThread
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
World, WorldMapManager

public abstract class TickingThread extends Object implements Runnable
  • Field Details

    • NANOS_IN_ONE_MILLI

      public static final int NANOS_IN_ONE_MILLI
      See Also:
    • NANOS_IN_ONE_SECOND

      public static final int NANOS_IN_ONE_SECOND
      See Also:
    • TPS

      public static final int TPS
      The number of ticks per second.
      See Also:
    • SLEEP_OFFSET

      public static long SLEEP_OFFSET
      Used to compensate for Thread.sleep being non-precise, we allow a small buffer to do a busy wait to ensure ticking accuracy.
  • Constructor Details

    • TickingThread

      public TickingThread(String threadName)
    • TickingThread

      public TickingThread(String threadName, int tps, boolean daemon)
  • Method Details

    • run

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

      @Nonnull public CompletableFuture<Void> start()
    • interrupt

      public boolean interrupt()
    • stop

      public void stop()
    • setTps

      public void setTps(int tps)
    • getTps

      public int getTps()
    • getTickStepNanos

      public int getTickStepNanos()
    • getBufferedTickLengthMetricSet

      public HistoricMetric getBufferedTickLengthMetricSet()
    • clearMetrics

      public void clearMetrics()
    • debugAssertInTickingThread

      public void debugAssertInTickingThread()
      Note: This doesn't fail if the thread has been shutdown. This is due to the timeout code in the stop() method, under normal conditions stopping the thread will succeed and so nothing will be running on the world thread to be able to call this.
    • isInThread

      public boolean isInThread()
    • isStarted

      public boolean isStarted()
    • getPossibleFailureCause

      @Nullable public PluginIdentifier getPossibleFailureCause()
    • getFailureException

      @Nullable public Throwable getFailureException()