Class SynchronousCallback

java.lang.Object
org.serviceconnector.util.SynchronousCallback
All Implemented Interfaces:
ISCMPMessageCallback, ISCMPSynchronousCallback
Direct Known Subclasses:
CommandCallback, SCServiceCallback, SCSessionServer.SCServerCallback

public abstract class SynchronousCallback extends Object implements ISCMPSynchronousCallback
The Class SynchronousCallback. Base functionality for getting messages synchronous. Means to wait for a call for the callback. This class is designed to be extended by various callback's. It provides synchronous flag to to save state if somebody is waiting for a message. Synchronous flag might be useful in subclasses. It only gets access to the newest message - it only queues one item. Queuing an arrived message happens only if someone is expecting (synchronous = true) a reply. This restriction prevents race conditions - late messages are ignored.
Author:
JTraber
  • Field Details

    • answer

      protected final BlockingQueue<SCMPMessage> answer
      Queue to store the answer.
    • synchronous

      protected volatile boolean synchronous
      The synchronous, marks if somebody waits for the message.
  • Constructor Details

    • SynchronousCallback

      public SynchronousCallback()
      Instantiates a new synchronous callback.
  • Method Details