class ReadWatcher extends SingletonQueryWatcher
QueryWatcher
for non-transactional reads.
Resolves with the first matching transition where the transaction
is null
and the entry is visible (the entry's current
state is ignored).startOrdinal
Constructor and Description |
---|
ReadWatcher(long expiration,
long timestamp,
long startOrdinal)
Create a new
ReadWatcher . |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
catchUp(EntryTransition transition,
long now)
Process a transition which was posted before the watcher was
placed in
TransitionWatchers object. |
(package private) boolean |
isInterested(EntryTransition transition,
long ordinal)
Return
true if this watcher cares about a given
visibility transition. |
(package private) void |
process(EntryTransition transition,
long now)
Process the given transition.
|
addTemplateHandle, getServer, isResolved, resolve, resolvedWithEntry, resolvedWithThrowable, waitOnResolution
getExpiration, removeIfExpired
compareTo
ReadWatcher(long expiration, long timestamp, long startOrdinal)
ReadWatcher
.expiration
- the initial expiration time
for this TransitionWatcher
in
milliseconds since the beginning of the epoch.timestamp
- the value that is used
to sort TransitionWatcher
s.startOrdinal
- the highest ordinal associated
with operations that are considered to have occurred
before the operation associated with this watcher.boolean isInterested(EntryTransition transition, long ordinal)
TransitionWatcher
true
if this watcher cares about a given
visibility transition. Assumes the transitioning entry matches
the template in the TemplateHandle
associated with
this watcher. This method should return a value even if the
expiration time has been reached or remove
has
been called. This call should not obtain any locks.isInterested
in class TransitionWatcher
transition
- A EntryTransition
that
describes the transition and what
entry is transitioning. This method
will assume that transition.getHandle
returns a non-null value.ordinal
- The ordinal associated with transition
.true
if this watcher is interested
in the indicated transition and false
otherwise.void process(EntryTransition transition, long now)
TransitionWatcher
TemplateHandle
associated with this
watcher and that isInterested
returned
true
. This call may make changes to the passed
EntryHandle
that will prevent it from being used by
other watchers. If remove
has been called or the
expiration time of this watcher has passed, this call should have no
effect. This call may cause the watcher to be removed.process
in class TransitionWatcher
transition
- A EntryTransition
that
describes the transition and what
entry is transitioning. This method
will assume that transition.getHandle
returns a non-null value.now
- An estimate of the current time (not the time
when the event occured).boolean catchUp(EntryTransition transition, long now)
QueryWatcher
TransitionWatchers
object. Assumes that
the entry in the transition matches matches the template in the
TemplateHandle
associated with this watcher. Does
not assume isInterested
has been called.catchUp
in class QueryWatcher
transition
- A EntryTransition
that
describes the transition and what
entry is transitioning. This method
will assume that transition.getHandle
returns a non-null value.now
- An estimate of the current time (not the time
when the event occured).true
if the query has been resolved, and
false
otherwise. Note, even if this
call returns true
, waitOnResolution
must still be called.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.