public final class KosUtil {
// Private constructor, as this is a utility class:
private KosUtil();
//--- Time and Sleep ---
// Returns the current actual time (in msec); same as System.currentTimeMillis():
public static long currentTimeMs();
// Returns the current mono time (monotonically increasing, in msec):
public static long currentMonoMs();
// Shorthand access to scheduler.sleep(), which allows for sleeping without the need to handle interrupts:
public static void sleep(long ms);
//--- JSON handling ---
// Returns the shared JSON (Jackson) object mapper:
public static ObjectMapper getMapper();
// Returns the shared JSON writer cache:
public static JsonWriterCache getWriters(); // [discussed on its own page]
//--- Executing and scheduling runnables ---
// Returns the system component that provides access to standard thread pools:
public static Scheduler getScheduler(); // [discussed on its own page]
// Shorthand access to scheduler.execute(), which runs a short duration task in a worker thread:
public static void execute(Runnable runnable);
// Shorthand access to scheduler.scheduleCallback(), which schedules a Runnable
// that is executed "delay" number of msec in the future:
public static ScheduledFuture<?> scheduleCallback(Runnable command, long delay);
}