Class SyncObject

java.lang.Object
de.gmxhome.conrad.jpos.jpos_base.SyncObject

public class SyncObject extends Object
Class used for synchronisation purposes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static long
    Constant for infinite wait
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor, initializes Semaphore used for synchronization.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Reset object to an unsignalled state
    void
    Wake up other thread, if suspended.
    boolean
    suspend​(long milliseconds)
    Suspends the current thread for a specified time or until signalled.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INFINITE

      public static final long INFINITE
      Constant for infinite wait
      See Also:
      Constant Field Values
  • Constructor Details

    • SyncObject

      public SyncObject()
      Constructor, initializes Semaphore used for synchronization.
  • Method Details

    • suspend

      public boolean suspend(long milliseconds)
      Suspends the current thread for a specified time or until signalled. Waits until timeout (in milliseconds, -1 = for ever) occurs or signalled by other thread
      Parameters:
      milliseconds - Timeout (-1: without timeout).
      Returns:
      true: SyncObject has been signalled, false otherwise.
    • signal

      public void signal()
      Wake up other thread, if suspended.
    • reset

      public void reset()
      Reset object to an unsignalled state