com.sun.jini.outrigger
Class WatchersForTemplateClass

java.lang.Object
  extended by com.sun.jini.outrigger.WatchersForTemplateClass

 class WatchersForTemplateClass
extends Object

Holds a collection of TemplateHandles who's templates are all of exactly the same class. Unless otherwise noted all methods are thread safe. This method provides the linkage between TemplateHandles and TransitionWatchers and for the most part is not visible to the clients of either.


Field Summary
private  FastList<TemplateHandle> contents
          All the templates we know about
private  TransitionWatchers owner
          The object we are inside of
 
Constructor Summary
WatchersForTemplateClass(TransitionWatchers owner)
          Create a new WatchersForTemplateClass object associated with the specified TransitionWatchers object.
 
Method Summary
(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)  void collectInterested(Set set, EntryTransition transition, long ordinal)
          Iterate over the watchers associated with this object calling isInterested on each and if it returns true adding the watcher to the passed set.
(package private)  OutriggerServerImpl getServer()
          Return the OutriggerServerImpl this handle is part of.
(package private)  void reap(long now)
          Visit each TransitionWatcher and check to see if it has expired, removing it if it has.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contents

private final FastList<TemplateHandle> contents
All the templates we know about


owner

private final TransitionWatchers owner
The object we are inside of

Constructor Detail

WatchersForTemplateClass

WatchersForTemplateClass(TransitionWatchers owner)
Create a new WatchersForTemplateClass object associated with the specified TransitionWatchers object.

Parameters:
owner - The TransitionWatchers that this object will be a part of.
Throws:
NullPointerException - if owner is null.
Method Detail

add

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. Associates a TemplateHandle using TransitionWatcher.setTemplateHandle method.

Parameters:
watcher - The TransitionWatcher being added.
template - The EntryRep that represents the template of interest.
Throws:
NullPointerException - if either argument is null.

collectInterested

void collectInterested(Set set,
                       EntryTransition transition,
                       long ordinal)
Iterate over the watchers associated with this object calling isInterested on each and if it returns true adding the watcher to the passed set.

Parameters:
set - The set to accumulate interested watchers into.
transition - The transition being processed.
ordinal - The ordinal associated with transition.
Throws:
NullPointerException - if either argument is null.

getServer

OutriggerServerImpl getServer()
Return the OutriggerServerImpl this handle is part of.

Returns:
The OutriggerServerImpl this handle is part of.

reap

void reap(long now)
Visit each TransitionWatcher and check to see if it has expired, removing it if it has. Also reaps the FastList associated with this object.

Parameters:
now - an estimate of the current time expressed as milliseconds since the beginning of the epoch.


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.