[Biojava-dev] Walker/Visitor code

Matthew Pocock matthew_pocock at yahoo.co.uk
Sat Jul 26 19:01:42 EDT 2003


 --- David Huen <smh1008 at cus.cam.ac.uk> wrote: 
> Two questions:-
> 1) is a Walker from WalkerFactory reentrant? i.e. is
> it thread-safe?

The current implementation of the walking method is
reentrant. If we used a stack rather than a recursive
function call to recurse through the feature filter
expressions it would become non-reentrant. It's realy
implementation specific. As for the walker as a whole,
if you are relying on the getValue() method to return
sane things for visitors that do return values, then
it is not reentrant - two threads could over-right
each others values.

Shall we document it as not?

> 
> 2) is a Walker one-time use only or can a Walker
> generated from the
> WalkerFactory be applied to successive
> FeatureFilters, calling getValue()
> between the walk() calls?

Walker instances can be re-used as many times as you
like.

> 
> Rgds,
> DH
> 
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at biojava.org
> http://biojava.org/mailman/listinfo/biojava-dev 

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/


More information about the biojava-dev mailing list