Class ClientEventPoll
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.jackrabbit.rmi.observation.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 theClientObservationManager
class. In addition this class extends thejava.lang.Thread
class 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
RemoteObservationManager
class. EventListener
s 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, for removal: This API element is subject to removal in a future version.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 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.EventListener[]
getListeners()
Deprecated, for removal: This API element is subject to removal in a future version.Returns an array of the registered event listeners.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.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.void
terminate()
Deprecated, for removal: This API element is subject to removal in a future version.Indicates to therun()
method, that asking for events should be terminated.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
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 givenRemoteObservationManager
.- Parameters:
remote
- The remote observation manager which is asked for new events. This must not benull
.session
- TheSession
which is asked whether it is alive by therun()
method. This must not benull
.- Throws:
NullPointerException
- ifremote
orsession
isnull
.
-
-
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
- TheEventListener
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
- TheEventListener
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 therun()
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:- 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
EventIterator
and call theEventListener.onEvent()
method. - Go back to step #1.
- Continue with next step if
-
-