class TransitionWatchers extends Object
EntryHandle
who's entry is making a
visibility transition this class will find all the
TransitionWatcher
s who are interested in that
transition. The TransitionWatcher
s are organized
into groups using TemplateHandle
. Each
TemplateHandle
aggregates a number of watchers
all interested in the same template.TransitionWatcher
Modifier and Type | Field and Description |
---|---|
private Map |
holders
A map from class names to
WatchersForTemplateClass
objects |
private OutriggerServerImpl |
server
The server we are working for
|
Constructor and Description |
---|
TransitionWatchers(OutriggerServerImpl server)
Create a new
TransitionWatchers object
for the specified server. |
Modifier and Type | Method and Description |
---|---|
(package private) void |
add(TransitionWatcher watcher,
EntryRep template)
Add a
TransitionWatcher to the list
of watchers looking for visibility transitions in
entries that match the specified template. |
(package private) SortedSet |
allMatches(EntryTransition transition,
long ordinal)
Return a
SortedSet of all the
TransitionWatcher who's isInterested
methods return true when asked about the specified
visibility transition. |
(package private) OutriggerServerImpl |
getServer()
Return the
OutriggerServerImpl this
TransitionWatchers object is part of. |
(package private) void |
reap()
Visit each
TransitionWatcher and check to see if
it has expired, removing it if it has. |
private final Map holders
WatchersForTemplateClass
objectsprivate final OutriggerServerImpl server
TransitionWatchers(OutriggerServerImpl server)
TransitionWatchers
object
for the specified server.server
- The server the new TransitionWatchers
object is working for.NullPointerException
- if server
is
null
void add(TransitionWatcher watcher, EntryRep template)
TransitionWatcher
to the list
of watchers looking for visibility transitions in
entries that match the specified template. Associates
a TemplateHandle
using
TransitionWatcher.setTemplateHandle
method.
This method is thread safe. The watcher added in this call is
guaranteed to be consulted by the next call to
allMatches
that starts after this call completes even
if that call is made from another thread. Also, all of
of the assigned values in the calling thread's working
memory will be copied out to main memory as part of the
process of making the passed watcher visible to future
allMatches
and findTransitionWatcher
calls.
watcher
- The TransitionWatcher
being added.template
- The EntryRep
that represents
the template of interest.NullPointerException
- if either argument is
null
.SortedSet allMatches(EntryTransition transition, long ordinal)
SortedSet
of all the
TransitionWatcher
who's isInterested
methods return true
when asked about the specified
visibility transition.
This method is thread safe. This call is guaranteed to check unremoved
watchers that were added by add
calls that completed
before this call started, even if the calls were made from
different threads. Before the isInterested
method
of the first watcher is called the working memory of this thread
will be flushed so any changes made to main memory before
this call started will be visible.
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
.SortedSet
of all the
TransitionWatcher
s interested in the specified
visibility transition. If none are interested an empty
map will be returned.NullPointerException
- if transition
is
null
.void reap()
TransitionWatcher
and check to see if
it has expired, removing it if it has. Also reap the
FastList
s.OutriggerServerImpl getServer()
OutriggerServerImpl
this
TransitionWatchers
object is part of.OutriggerServerImpl
this
TransitionWatchers
is part of.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.