[Biojava-l] Changable and rollbacks

Matthew Pocock mrp@sanger.ac.uk
Fri, 11 May 2001 12:44:35 +0100


Schreiber, Mark wrote:

> Is there a way to test if a change is going to be vetoed before it is
> attempted??
> 
> For example I would like to peform an operation on a list of sequences but
> if I get halfway throught the list and suddenly find a sequence which cannot
> be changes I would like to throw an exception and roll back the changes
> already made. It would be better if I could check to make sure everything
> will be OK before starting.
> 
> Can anyone help with this??
> 
> Mark

This sort of thing is not easily supported with the current model, but I 
agree that it is a usefull thing to have. One way to do it would be to 
make an entity that represented the list of sequences and has a 
commitAll style method. This would do some package-private diddling 
inside each sequence it contains to check the prechange vetoes, and if 
successfull perform each real commit.

This does, however, require us to think again about the encapsulation of 
the pre/post change infrastructure (particularly as we may need to 
synchronize on some resource to maintain atomicity).

All thoughts welcome.

M

> 
> 
> Mark Schreiber
> Bioinformatics
> AgResearch Invermay
> PO Box 50034
> Mosgiel
> New Zealand
> 
> PH: +64 3 489 9175
> 
>  
> 
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l