|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.outrigger.FastList.Node
com.sun.jini.outrigger.BaseHandle
com.sun.jini.outrigger.TemplateHandle
class TemplateHandle
TemplateHandle
associates one or more
TransitionWatcher
s with a template.
Unless otherwise noted all methods are thread safe.
Field Summary | |
---|---|
private Vector |
descs
A cache of the EntryHandleTmplDesc indexed
by the number of fields. |
private WatchersForTemplateClass |
owner
The WatchersForTemplateClass this object
belongs to. |
private Set |
watchers
The watchers. |
Constructor Summary | |
---|---|
TemplateHandle(EntryRep tmpl,
WatchersForTemplateClass owner)
Create a handle for the template tmpl . |
Method Summary | |
---|---|
(package private) void |
addTransitionWatcher(TransitionWatcher watcher)
Add a watcher to this handle. |
(package private) void |
collectInterested(Set set,
EntryTransition transition,
long ordinal)
Iterate over the watchers associated with this handle calling isInterested on each
and if it returns true adding the watcher to the
passed set. |
(package private) EntryHandleTmplDesc |
descFor(int numFields)
Return the description for the given field count. |
(package private) OutriggerServerImpl |
getServer()
Return the OutriggerServerImpl this
handle is part of. |
(package private) boolean |
isEmpty()
Return true if there are no watchers associated
with this object and false otherwise. |
(package private) boolean |
matches(EntryRep entry)
Return true if this template matches the given entry. |
(package private) void |
reap(long now)
Visit each TransitionWatcher and check to see if
it has expired, removing it if it has. |
(package private) void |
removeTransitionWatcher(TransitionWatcher watcher)
Remote a watcher from this handle. |
Methods inherited from class com.sun.jini.outrigger.BaseHandle |
---|
classFor, rep |
Methods inherited from class com.sun.jini.outrigger.FastList.Node |
---|
markOnList, removed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Vector descs
EntryHandleTmplDesc
indexed
by the number of fields.
private final Set watchers
HashSet
because we will
probably do a fair number of removals for each traversal and
the number of watchers managed by one TemplateHandle
will probably never get very large. If this does become an
issue making TransitionWatcher
extend
FastList.Node
and using a FastList
here would probably be a good choice (though that would require
changing FastList
to support overlapping traversals
of different lists from the same thread.)
private final WatchersForTemplateClass owner
WatchersForTemplateClass
this object
belongs to.
Constructor Detail |
---|
TemplateHandle(EntryRep tmpl, WatchersForTemplateClass owner)
tmpl
.
Method Detail |
---|
EntryHandleTmplDesc descFor(int numFields)
boolean matches(EntryRep entry)
true
if this template matches the given entry.
void addTransitionWatcher(TransitionWatcher watcher)
FastList
and that
the caller owns the lock on this
.
watcher
- the watcher to be added.
NullPointerException
- if watcher is null
.void removeTransitionWatcher(TransitionWatcher watcher)
TemplateHandle
.
watcher
- the watcher to be removed.
NullPointerException
- if watcher is null
.void collectInterested(Set set, EntryTransition transition, long ordinal)
isInterested
on each
and if it returns true
adding the watcher to the
passed set.
set
- The set to accumulate interested watchers
into.transition
- The transition being processed.ordinal
- The ordinal associated with transition
.
NullPointerException
- if either argument is null
.OutriggerServerImpl getServer()
OutriggerServerImpl
this
handle is part of.
OutriggerServerImpl
this
handle is part of.void reap(long now)
TransitionWatcher
and check to see if
it has expired, removing it if it has.
now
- an estimate of the current time expressed as
milliseconds since the beginning of the epoch.boolean isEmpty()
true
if there are no watchers associated
with this object and false
otherwise. Assumes
the call holds the lock on this
.
true
if there are no watchers in this handle.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |