Class ClientEventPoll
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.jackrabbit.rmi.observation.ClientEventPoll
-
- All Implemented Interfaces:
Runnable
@Deprecated public class ClientEventPoll extends Thread
Deprecated.RMI support is deprecated and will be removed in a future version of Jackrabbit; see Jira ticket JCR-4972 for more information.The
ClientEventPollclass is the registry for client-side event listeners on behalf of theClientObservationManagerclass. In addition this class extends thejava.lang.Threadclass able to be run in a separate thread to constantly poll the server-side observation manager for new events.Notes:
- Only one instance of this class should be instantiated for each instance
of a
RemoteObservationManagerclass. EventListeners registered with this class must properly implement theObject.hashCode()andObject.equals()contracts for them to be handled correctly by this class.
- See Also:
run()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ClientEventPoll(RemoteObservationManager remote, Session session)Deprecated.Creates an instance of this class talking to the givenRemoteObservationManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description longaddListener(EventListener listener)Deprecated.Registers the given local listener with this instance and returns the unique identifier assigned to it.EventListener[]getListeners()Deprecated.Returns an array of the registered event listeners.longremoveListener(EventListener listener)Deprecated.Unregisters the given local listener from this instance and returns the unique identifier assigned to it.voidrun()Deprecated.Checks for remote events and dispatches them to the locally registered event listeners.voidterminate()Deprecated.Indicates to therun()method, that asking for events should be terminated.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
ClientEventPoll
public ClientEventPoll(RemoteObservationManager remote, Session session) throws NullPointerException
Deprecated.Creates an instance of this class talking to the givenRemoteObservationManager.- Parameters:
remote- The remote observation manager which is asked for new events. This must not benull.session- TheSessionwhich is asked whether it is alive by therun()method. This must not benull.- Throws:
NullPointerException- ifremoteorsessionisnull.
-
-
Method Detail
-
addListener
public long addListener(EventListener listener)
Deprecated.Registers the given local listener with this instance and returns the unique identifier assigned to it.- Parameters:
listener- TheEventListenerto register.- Returns:
- The unique identifier assigned to the newly registered event listener.
-
removeListener
public long removeListener(EventListener listener)
Deprecated.Unregisters the given local listener from this instance and returns the unique identifier assigned to it.- Parameters:
listener- TheEventListenerto unregister.- Returns:
- The unique identifier assigned to the unregistered event listener
or
-1if the listener was not registered.
-
getListeners
public EventListener[] getListeners()
Deprecated.Returns an array of the registered event listeners.- Returns:
- registered event listeners
-
terminate
public void terminate()
Deprecated.Indicates to therun()method, that asking for events should be terminated.- See Also:
run()
-
run
public void run()
Deprecated.Checks for remote events and dispatches them to the locally registered event listeners. This is how this method works:- Continue with next step if
terminate()has not been called yet and the session is still alive. - Call the
RemoteObservationManager.getNextEvent(long)method waiting for a specified time (5 seconds). - If no event was received in the specified time go back to step #1.
- 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.
- Convert the remote event list to an
EventIteratorand call theEventListener.onEvent()method. - Go back to step #1.
- Continue with next step if
-
-