Interface ServerThreadLock

All Superinterfaces:
AutoCloseable, Terminable

public interface ServerThreadLock extends Terminable
A tool to synchronize code with the main server thread.

It is highly recommended to use this interface with try-with-resource blocks.

See Also:
  • Method Details

    • obtain

      static ServerThreadLock obtain()
      Blocks the current thread until a ServerThreadLock can be obtained.

      Will attempt to return immediately if the calling thread is the main thread itself.

      Returns:
      a lock
    • close

      void close()
      Closes the lock, and allows the main thread to continue
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Terminable