Re: So why are things being executed twice on every transaction?
Fabio Roger <[email protected]>
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <CAKsVvESBFC3Z3Rd=YHaXrZ-BSas-=nryc3L3LJ4OtwnktfEvWQ@mail.gmail.com> |
What if, inside your transaction, an exception is thrown? you wouldn't now what the transaction already changed before throwing, right? So, prevayler makes sure the transaction can execute properly (without throwing an exception) by executing it first on a copy of your object model, the so called "food taster". If you can live without consistency and atomicity, then just turn off the food taster. Which is strongly discouraged. Fabio On 7 November 2011 01:27, Naveen Chawla <[email protected]> wrote: > Put a System.out.println in a transaction and it's outputted twice. > It's preventing my direct-transaction version from working properly > (e.g. if I add 1 to something, it ends up adding 2). On the > deserialize-then-execute version it has no effect on the output, > because it's carrying out on a deserialized copy each time. > Nonetheless, isn't it a little wasteful? I mean, isn't it making > Prevayler run twice as slow as it could? Meaning couldn't it be > carrying out its business once instead of twice? > > Upon examination I found it's: > > 1. the "royalFoodTaster.receive(timestampCopy);" in > "StrictTransactionCensor.java" (line 31) > 2. the "notifySubscribers()" call at the end of > "publishWithoutWorryingAboutNewSubscriptions()" in > "CentralPublisher.java" (line 65). > > Commenting out either line fixes things. What is the ideal > configuration for now in your view? > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion > _______________________________________________ > "Databases in Memoriam" -- http://www.prevayler.org > ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion _______________________________________________ "Databases in Memoriam" -- http://www.prevayler.org