Class EventHandlerImpl<T>


  • public class EventHandlerImpl<T>
    extends Object
    Implements the binding between the Speech SDK core event handler and Java event handling.
    • Constructor Detail

      • EventHandlerImpl

        public EventHandlerImpl​(AtomicInteger runCounter)
        Creates and initializes a new instance of the EventHandlerImpl.
        Parameters:
        runCounter - Counter to track if an event is in progress or not.
    • Method Detail

      • updateNotificationOnConnected

        public void updateNotificationOnConnected​(Runnable notifyConnectedOnce)
        Updates the handler to be notified when the first client subscribes to the event.
        Parameters:
        notifyConnectedOnce - The handler to be called when the first client subscribes to the event. If there is already a client subscribed, the callback is immediately invoked.
      • isUpdateNotificationOnConnectedFired

        public boolean isUpdateNotificationOnConnectedFired()
        Checks if a client has subscribed to events.
        Returns:
        True if a client has subscribed to events, false otherwise.
      • addEventListener

        public void addEventListener​(EventHandler<T> handler)
        Registers a new event handler with the associated event.
        Parameters:
        handler - The handler.
      • removeEventListener

        public void removeEventListener​(EventHandler<T> handler)
        Unregisters the event handler from the associated event.
        Parameters:
        handler - The handler.
      • fireEvent

        public void fireEvent​(Object sender,
                              T e)
        Fires an event by calling sequentially all registered handlers.
        Parameters:
        sender - The origin of the event.
        e - The event.