From: thomas at tada.se (Thomas Hallgren) Date: Fri, 22 Sep 2006 10:22:34 +0200 Subject: [Pljava-dev] Best way to pass intermediate state In-Reply-To: <451298E8.6090308@logix-tt.com> References: <450ABBE5.3060708@logix-tt.com> <451298E8.6090308@logix-tt.com> Message-ID: <45139D4A.4020002@tada.se> Take a look at whats offered by the org.postgresql.pljava.SessionManager. It has a static method that returns a Session object. This object can store arbitrary objects as attributes. The difference between the Session and a normal Map, is that the stuff stored in the Session is under transaction control. A rollback disregards changes made since last commit. The Session object will also allow you to add listeners for transactions and savepoints. Kind Regards, Thomas Hallgren Markus Schaber wrote: > Hi, all, > > Markus Schaber wrote: > > >> I'm currently thinking about implementing Aggregates in pljava. What's >> the best way to pass a complex intermediate state between the different >> iterations and the finalizing functions? >> >> I'd like to avoid repeated de/re-serialization of the objects into an >> official PostgreSQL data type due to efficiency reasons. >> > > As no ideas were offered here, I'm currently thinking about saving the > intermediate states in some kind of global hashed variable. > > For the cleanup work, in case the query is aborted in the middle (and so > the finishing function is never called), is there any way I can register > a hook that gets called on commit / rollback of the current > (sub)transaction? > > Thanks, > Markus > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pljava-dev mailing list > Pljava-dev at gborg.postgresql.org > http://gborg.postgresql.org/mailman/listinfo/pljava-dev >