[Biojava-l] small change to changeable, big change to lots of files

Matthew Pocock matthew_pocock@yahoo.co.uk
Wed, 24 Apr 2002 16:41:12 +0100


Hi all,

I added the isUnchangeable method to the Changeable interface. This 
broke _everything_ we have. I then spent untill now fixing biojava. The 
upshot is that there is partial support for isUnchangeable throughout 
the project, and I have nailed countless synchronization and 
serialization bugs related to ChangeSupport and its use. ChangeSupport 
is now thread-safe.

I am going to check the isUnchangeable code-base in this evening. Many 
many files are touched, so I would be very supprised if all old 
applications ran without a glitch against the new code-base without 
modification. Please send the list bug reports if you experience problems.

Thomas and I have been chatting about propper ways to hide 
synchronization arround the firePreChange and firePostChange calls from 
coders. Our best solution is to modify ChangeSupport to have a single 
method in place of firePre/PostChange called fireChange. This will take 
a small closure and a ChangeEvent as arguments, and the closure will be 
responsible for performing the actual update for the filed. These 
closures are stateless with respect to the value being changed, but are 
expected to know which field in an object to modify. This lets us be 
sensible about synchronization, and lazy about copying lists of 
ChangeListener items so that we can go as near to full speed as possible 
for the usual case of processing single events on a single processor 
machine in a single thread while being bulletproof for the case of 
fireing multiple events in multiple threads on a multi-cpu box. The use 
of these closures moves us one step closer to fully nested 
transactionality on biojava objects (e.g. if writing any one of 50 
sequences to a seqDB fails, don't write any of them).

I may get time to code this up over the weekend or in the second half of 
next week.

Matthew

ps if noone says I've broken their code, I will be very worried that 
noone is out there