Re: Chainvayler
"Justin T. Sampson" <[email protected]> Thu, 23 Apr 2020 17:25:07 -0700
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <CAAshuuER-BCDPgR71K32G3icwYBcgtPGTvN=QVi8F40O61gEUg@mail.gmail.com> |
--===============4694100010537074680== Content-Type: multipart/alternative; boundary="00000000000072833105a3fe66a4" --00000000000072833105a3fe66a4 Content-Type: text/plain; charset="UTF-8" Nice write-up! Thanks for sharing. Cheers, Justin On Wed, Apr 22, 2020 at 11:36 PM hakan eryargi <[email protected]> wrote: > Hey guys, > > Remember my PoC project *Postvayler* many years ago? It was making POJOs > persistent transparently based on @annotations and of course Prevayler. > > Recently I took the idea one step forward and extended the mechanism to > also replicate POJOs among JVMs. > > Here is my blog post about it: > > https://medium.com/@hakan.eryargi/transparent-replication-and-persistence-for-pojo-graphs-805d9ae0f776 > > > Here is the project *Chainvayler* itself: > https://github.com/raftAtGit/Chainvayler > > Personally I find the idea really promising :) > > Cheers, > Hakan (r a f t) > > PS: I'm somehow got out from the email list, re-registered myself. > > On Mon, Dec 2, 2013 at 12:12 AM hakan eryargi <[email protected]> > wrote: > >> i'm experimenting with the idea. so far not bad. just put what I've done >> to GitHub. any suggestions, critics and contributions are welcome:) >> https://github.com/raftAtGit/Postvayler >> >> apologies for the name, it sounded like a nice word play:) >> >> to run the sample, run the Compiler class >> with raft.postvayler.samples.bank.Bank argument and then run >> raft.postvayler.samples.bank.Main >> >> how it works: >> compiler injects bytecode to root class and all @Persistent classes that >> can be accesible* from root. >> >> root class contains an injected object pool, where each @Persistent class >> is assigned a Long id and put into this object pool when created. this pool >> will be* a WeakValueMap so objects which are not attached to root will be >> garbage collected at some time. >> >> each @Persist method in a @Persistent class is instrumented like this: >> @Persist >> ReturnType doSomething(someParams) {..} >> >> doSomehing is copied to __postvayler__doSomething(..). the original doSomehing >> becomes: >> >> ReturnType doSomething(someParams) { >> if (!there is postvayler context) >> return __postvayler__doSomething(..); >> if (we are in a prevayler transaction) >> return __postvayler__doSomething(..); >> return prevayler.execute(new MethodTransaction(..)); >> } >> >> the arguments to doSomehing(..) is transformed in MethodTransaction such >> that references to @Persistent objects are replaced with Reference's, >> which will later be restored from object pool. seems as this also solves >> the Baptism problem. >> >> looks good to me for now:) >> >> cheers, >> *r a f t* >> >> * not implemented yet >> >> On Wed, Nov 27, 2013 at 11:07 AM, Naveen Chawla <[email protected]> >> wrote: >> >>> Sure, here: >>> http://docs.oracle.com/javase/tutorial/java/generics/methods.html >>> >>> As for consistency, any multi-changes explicitly synchronized over >>> prevalentObject can be auto-batched. >>> >>> >>> On 27 November 2013 00:25, Klaus Wuestefeld <[email protected]> wrote: >>> >>>> > It is ordinary generic method syntax. >>>> >>>> Could you point me to some doc on this syntax? I couldnt find it here: >>>> http://docs.oracle.com/javase/tutorial/extra/generics/methods.html >>>> >>>> > The beginning and end of a transaction would simply be any change to >>>> any >>>> > non-transient field. >>>> >>>> Suppose a transaction needs to update two fields to be correct but the >>>> system crashes after the first. Will the system not be inconsistent on >>>> recovery? >>>> >>>> Klaus >>>> >>> --00000000000072833105a3fe66a4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Nice=C2=A0write-up! Thanks for sharing.</div><div><br= ></div><div>Cheers,</div><div>Justin</div><br><div class=3D"gmail_quote"><d= iv dir=3D"ltr" class=3D"gmail_attr">On Wed, Apr 22, 2020 at 11:36 PM hakan = eryargi <<a href=3D"mailto:[email protected]">hakan.eryargi@gmail.= com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x"><div dir=3D"ltr"><div dir=3D"ltr"><div>Hey guys,</div><div><br></div><di= v>Remember my PoC project <b>Postvayler</b> many years=C2=A0ago? It was mak= ing POJOs persistent transparently based on=C2=A0@annotations and of course= Prevayler.</div><div><br></div><div>Recently I took the idea one step forw= ard and extended the mechanism to also replicate POJOs among JVMs.</div><di= v><br></div><div>Here is my blog post about it:</div><div><a href=3D"https:= //medium.com/@hakan.eryargi/transparent-replication-and-persistence-for-poj= o-graphs-805d9ae0f776" target=3D"_blank">https://medium.com/@hakan.eryargi/= transparent-replication-and-persistence-for-pojo-graphs-805d9ae0f776</a>=C2= =A0</div><div><br></div><div>Here is the project <b>Chainvayler</b> itself:= =C2=A0<br></div><div><a href=3D"https://github.com/raftAtGit/Chainvayler" t= arget=3D"_blank">https://github.com/raftAtGit/Chainvayler</a>=C2=A0</div><d= iv><br></div><div>Personally I find the idea really promising :)</div><div>= <br></div><div>Cheers,</div><div>Hakan (r a f t)=C2=A0</div><div><br></div>= <div>PS: I'm somehow got out from the email list, re-registered myself.= </div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_= attr">On Mon, Dec 2, 2013 at 12:12 AM hakan eryargi <<a href=3D"mailto:h= [email protected]" target=3D"_blank">[email protected]</a>> w= rote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p= x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir= =3D"ltr">i'm experimenting with the idea. so far not bad. just put what= I've done to GitHub. any suggestions, critics and contributions are we= lcome:)<div><a href=3D"https://github.com/raftAtGit/Postvayler" target=3D"_= blank">https://github.com/raftAtGit/Postvayler</a></div> <div><br></div><div>apologies for the name, it=C2=A0sounded like a nice wor= d play:)<br></div><div><br></div><div><div>to run the sample, run the Compi= ler class with=C2=A0raft.postvayler.samples.bank.Bank argument and then run= raft.postvayler.samples.bank.Main</div> <div><br></div><div>how it works:</div><div>compiler injects bytecode to ro= ot class and all @Persistent=C2=A0classes that can be accesible* from root.= =C2=A0</div><div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_e= xtra">root class contains an injected object pool, where each @Persistent c= lass is assigned a Long id and put into this object pool when created. this= pool will be* a WeakValueMap so objects which are not attached to root wil= l be garbage collected at some time.</div> <div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">each @Persi= st method in a=C2=A0@Persistent class is instrumented like this:</div><div = class=3D"gmail_extra"><font face=3D"courier new, monospace">@Persist</font>= </div><div class=3D"gmail_extra"> <font face=3D"courier new, monospace">ReturnType doSomething(someParams) {.= .}</font></div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_ext= ra"><font face=3D"courier new, monospace">doSomehing </font>is copied to <f= ont face=3D"courier new, monospace">__postvayler__doSomething(..)</font>. t= he original <font face=3D"courier new, monospace">doSomehing </font>becomes= :<br> </div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra"><font= face=3D"courier new, monospace">ReturnType=C2=A0doSomething(someParams) {<= /font></div><div class=3D"gmail_extra"><font face=3D"courier new, monospace= ">=C2=A0 =C2=A0 if (!there is postvayler context)=C2=A0</font></div> <div class=3D"gmail_extra"><font face=3D"courier new, monospace">=C2=A0 =C2= =A0 =C2=A0 =C2=A0 return __postvayler__doSomething(..);</font></div><div cl= ass=3D"gmail_extra"><font face=3D"courier new, monospace">=C2=A0 =C2=A0 if = (we are in a prevayler transaction)=C2=A0</font></div> <div class=3D"gmail_extra"><font face=3D"courier new, monospace">=C2=A0 =C2= =A0 =C2=A0 =C2=A0 return __postvayler__doSomething(..);</font></div><div cl= ass=3D"gmail_extra"><font face=3D"courier new, monospace">=C2=A0 =C2=A0 ret= urn prevayler.execute(new MethodTransaction(..));</font></div> <div class=3D"gmail_extra"><font face=3D"courier new, monospace">}<br></fon= t></div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">the= arguments to doSomehing(..) is transformed in <font face=3D"courier new, m= onospace">MethodTransaction </font>such that references to @Persistent obje= cts are replaced with <font face=3D"courier new, monospace">Reference'<= /font><font face=3D"arial, helvetica, sans-serif">s</font>, which will late= r be restored from object pool. seems as this also solves the Baptism probl= em.=C2=A0</div> <div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">looks good = to me for now:)</div><div class=3D"gmail_extra"><br></div><div class=3D"gma= il_extra">cheers,</div><div class=3D"gmail_extra"><i>r a f t</i></div><div = class=3D"gmail_extra"> <br></div><div class=3D"gmail_extra">* not implemented yet</div><div class= =3D"gmail_extra"><br><div class=3D"gmail_quote">On Wed, Nov 27, 2013 at 11:= 07 AM, Naveen Chawla <span dir=3D"ltr"><<a href=3D"mailto:naveen.chwl@gm= ail.com" target=3D"_blank">[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Sure, he= re:=C2=A0<a href=3D"http://docs.oracle.com/javase/tutorial/java/generics/me= thods.html" target=3D"_blank">http://docs.oracle.com/javase/tutorial/java/g= enerics/methods.html</a><div> <br></div><div>As for consistency, any multi-changes explicitly synchronize= d over prevalentObject can be auto-batched.</div> </div><div><div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quot= e">On 27 November 2013 00:25, Klaus Wuestefeld <span dir=3D"ltr"><<a hre= f=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>></span>= wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"> <div>> It is ordinary generic method syntax.<br> <br> </div>Could you point me to some doc on this syntax? I couldnt find it here= :<br> <a href=3D"http://docs.oracle.com/javase/tutorial/extra/generics/methods.ht= ml" target=3D"_blank">http://docs.oracle.com/javase/tutorial/extra/generics= /methods.html</a><br> <div><br> > The beginning and end of a transaction would simply be any change to a= ny<br> > non-transient field.<br> <br> </div>Suppose a transaction needs to update two fields to be correct but th= e<br> system crashes after the first. Will the system not be inconsistent on<br> recovery?<br> <div><div><br> Klaus</div></div></blockquote></div></div></div></div></blockquote></div></= div></div></div></div></blockquote></div></div> </blockquote></div></div> --00000000000072833105a3fe66a4-- --===============4694100010537074680== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============4694100010537074680== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion _______________________________________________ "Databases in Memoriam" -- http://www.prevayler.org --===============4694100010537074680==--