Contents
Class TickingThread
java.lang.Object
com.hypixel.hytale.server.core.util.thread.TickingThread
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
World, WorldMapManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic longUsed to compensate for Thread.sleep being non-precise, we allow a small buffer to do a busy wait to ensure ticking accuracy.static final intThe number of ticks per second. -
Constructor Summary
ConstructorsConstructorDescriptionTickingThread(String threadName) TickingThread(String threadName, int tps, boolean daemon) -
Method Summary
-
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 TPSThe number of ticks per second.- See Also:
-
SLEEP_OFFSET
public static long SLEEP_OFFSETUsed 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
-
TickingThread
-
-
Method Details
-
run
-
start
-
interrupt
public boolean interrupt() -
stop
public void stop() -
setTps
public void setTps(int tps) -
getTps
public int getTps() -
getTickStepNanos
public int getTickStepNanos() -
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 thestop()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
-
getFailureException
-