Class ClientEventPoll

  • All Implemented Interfaces:
    Runnable

    @Deprecated(forRemoval=true)
    public class ClientEventPoll
    extends Thread
    Deprecated, for removal: This API element is subject to removal in a future version.
    RMI support is deprecated and will be removed in a future version of Jackrabbit; see Jira ticket JCR-4972 for more information.

    The ClientEventPoll class is the registry for client-side event listeners on behalf of the ClientObservationManager class. In addition this class extends the java.lang.Thread class able to be run in a separate thread to constantly poll the server-side observation manager for new events.

    Notes:

    1. Only one instance of this class should be instantiated for each instance of a RemoteObservationManager class.
    2. EventListeners registered with this class must properly implement the Object.hashCode() and Object.equals() contracts for them to be handled correctly by this class.
    See Also:
    run()
    • Constructor Detail

      • ClientEventPoll

        public ClientEventPoll​(RemoteObservationManager remote,
                               Session session)
                        throws NullPointerException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates an instance of this class talking to the given RemoteObservationManager.
        Parameters:
        remote - The remote observation manager which is asked for new events. This must not be null.
        session - The Session which is asked whether it is alive by the run() method. This must not be null.
        Throws:
        NullPointerException - if remote or session is null.
    • Method Detail

      • addListener

        public long addListener​(EventListener listener)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Registers the given local listener with this instance and returns the unique identifier assigned to it.
        Parameters:
        listener - The EventListener to register.
        Returns:
        The unique identifier assigned to the newly registered event listener.
      • removeListener

        public long removeListener​(EventListener listener)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Unregisters the given local listener from this instance and returns the unique identifier assigned to it.
        Parameters:
        listener - The EventListener to unregister.
        Returns:
        The unique identifier assigned to the unregistered event listener or -1 if the listener was not registered.
      • getListeners

        public EventListener[] getListeners()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns an array of the registered event listeners.
        Returns:
        registered event listeners
      • terminate

        public void terminate()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Indicates to the run() method, that asking for events should be terminated.
        See Also:
        run()
      • run

        public void run()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Checks for remote events and dispatches them to the locally registered event listeners. This is how this method works:
        1. Continue with next step if terminate() has not been called yet and the session is still alive.
        2. Call the RemoteObservationManager.getNextEvent(long) method waiting for a specified time (5 seconds).
        3. If no event was received in the specified time go back to step #1.
        4. Extract the unique listener identifier from the remote event and find it in the list of locally registered event listeners. Go back to step #1 if no such listener exists.
        5. Convert the remote event list to an EventIterator and call the EventListener.onEvent() method.
        6. Go back to step #1.
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread