A Meta-Object Library for Distributed Systems Relat Orio T
Total Page:16
File Type:pdf, Size:1020Kb
O conteudo do presente relatorio e de unica resp onsabilidade dos autores The contents of this rep ort are the sole resp onsibility of the authors An Overview of MOLDS A MetaOb ject Library for Distributed Systems Alexandre Oliva Luiz Eduardo Buzato Relatorio Tecnico IC Abril de An Overview of MOLDS A MetaOb ject Library for Distributed Systems Alexandre Oliva Luiz Eduardo Buzato olivadccunicampbr buzatodccunicampbr Lab oratorio de Sistemas Distribudos Instituto de Computacao Universidade Estadual de Campinas April Abstract This pap er presents a library of metaob jects suitable for developing distributed systems The reexive architecture of Guarana makes it p ossible for these metaob jects to b e easily combined in order to form complex dynamically recongurable metalevel b ehavior We briey describ e the implementation of Guarana on Java Then we explain how several metalevel services such as p ersistence distribution replication and atomicity can b e implemented in a transparent and exible way Resumo Este artigo apresenta uma biblioteca de metaob jetos adequada para o desenvolvimento de sistemas distribudos A arquitetura reexiva Guarana torna p ossvel que esses metaob jetos sejam facilmente combinados a m de desemp enhar comp ortamento de metanvel complexo e reconguravel dinamica TM mente Descrevese sucintamente a implementacao de Guarana em Java Em seguida explicase como varios servicos de metanvel como p ersistencia distribuicao replicacao e atomicidade p o dem ser implementados de forma transparente e exvel Keywords Reection Distributed Ob jects Persistence Replication Atomic Actions Java is a trademark of Sun Microsystems Inc Intro duction A metaob ject may reply with a result for the op eration an alternate op eration to b e p erformed Computational reection henceforth just re instead of the one requested by the baselevel or a ection has proven to b e a useful feature for build request for the original op eration to b e p erformed ing distributed systems in a transparent way Unless it provides a result itself it may ask to b e presented the result of the op eration after it is p er Guarana is a reexive architecture that aims formed or even to b e able to mo dify this result at reuse of reexive solutions It provides sim Any metaob ject is an instance of the class ple mechanisms for combining multiple metaob jects MetaObject that is a Java class just like any other into the metalevel conguration of a single ob ject Hence its instances may b e made reexive to o by as These metaob jects may implement metalevel re so ciating them with other metaob jects which leads quirements such as distribution p ersistence repli to the socalled p otentially innite tower of meta cation atomicity etc ob jects This class may b e sp ecialized sub This pap er is organized as follows In Section classed which leads to one of the key concepts intro we briey describ e our implementation of the re duced by Guarana a sub class of MetaObject called exive architecture of Guarana on top of a mo di Comp oser ed freelyavailable Java Virtual Machine Then we A comp oser is a metaob ject that delegates op er intro duce MOLDS a library of metaob jects that ations and results to other metaob jects Comp osers provide essential features for developing reliable dis may delegate to metaob jects sequentially or concur tributed systems Finally in Section we summarize rently or following whatever p olicy ts the needs of the b enets of designing a library such as MOLDS in a develop er A sample comp oser is provided that a reexive architecture like Guarana and describ e delegates op erations to the elements of an array of the current state of development of b oth Guarana metaob jects and delegates results to the same meta and MOLDS ob jects in the reverse order Some of the delegatee metaob jects of a com p oser can b e comp osers themselves which leads to The Javabased implementa a hierarchical organization of the metaob jects di rectly or indirectly asso ciated with a baselevel ob tion of Guarana ject This organization called the ob jects meta conguration is orthogonal to the tower of meta Java is a simple yet p owerful ob jectoriented ob jects each metaob ject may have its own indep en language Java classes are compiled into highlevel dent metaconguration Furthermore a metaob ject ob jectoriented crossplatform byteco des that can b e may b elong to the metaconguration of more than executed on Java Virtual Machines JVM Since the one ob ject sp ecication of the JVM is op en anyone can im Asso ciating an ob ject with its primary meta plement it so Java has b ecome available on several ob ject is an op eration provided by the kernel of dierent hardware platforms and freelymo diable Guarana In fact this op eration is so general that and redistributable source co de for some of these im it allows any metaob ject in a metaconguration to plementations is available at no cost The reexive b e replaced with another Any reconguration must architecture of Guarana was implemented on top of b e approved by the previous metaconguration if one of these platforms the baselevel ob ject was not reexive its class is in In Guarana every Java ob ject may b e directly formed ab out the reconguration request and may asso ciated with zero or one metaob ject called the prevent it ob jects primary metaob ject An ob ject that is as so ciated with a metaob ject will b e called a reex Ob jects created by reexive ob jects have their 2 ive ob ject Every op eration targeted to a reexive metacongurations determined by their creators ob ject is intercepted reied represented as a meta metaconguration Furthermore the meta level ob ject and presented to the ob jects primary conguration of the class of the new ob ject is notied metaob ject b efore the ob jects constructor is invoked so that it By op eration we mean metho ds and constructors invo cations monitor synchronized enter and exit op erations eld reads and writes Since Java arrays are ob jects to o array elements reads and writes as well as array length reads are considered op erations to o may try to mo dify the metaconguration of its new Persistence instance The kernel of Guarana makes it p ossi ble to create pseudoob jects that are uninitialized in A p ersistent ob ject is one whose lifetime spans stances of a given class These ob jects may b e turned the application that created it The state of p er into real ob jects by invoking a constructor or initial sistent ob jects can b e stored in les databases or izing its elds but it may remain a pseudoob ject longrunning pro cesses An ob ject can b e made p er and b e used for example as a proxy of an ob ject sistent by simply adding a p ersistence metaob ject to in a separate address spaces The metaconguration its metaconguration of the class the pseudoob ject b elongs to is also no A p ersistence metaob ject may b e implemented tied so it may mo dify the pseudoob jects meta using two dierent approaches i it may intercept conguration or even prevent the creation of the all eld up date op erations and up date the p ersis pseudoob ject tent storage accordingly p ossibly in background or This notication is done by using another op er ii it may up date the p ersistent storage only when the ation provided by the kernel of Guarana any in p ersistent ob ject is no longer used by the running ap stance of a class that implements the interface Mes plication sage can b e broadcasted to p ossibly all comp onent Whatever the choice every ob ject must b e given metaob jects of a metaconguration of an ob ject a unique identier that can b e used for maintain Such an op eration is necessary b ecause for security ing references from one p ersistent ob ject to another reasons we made it is imp ossible to obtain a refer as well as for reincarnating an ob ject from p ersistent ence to the primary metaob ject of an ob ject Fur storage into a running application This unique iden thermore we b elieve this helps maintaining a clear tier might b e maintained by the p ersistence meta separation of concerns b etween the base and the meta ob ject itself however a unique identier may b e use level just like encapsulation encourages go o d ob ject ful for other purp oses so we recommend the creation oriented design of a separate identication metaob ject Guarana provides an interface that allows arbi Whenever an ob jecttyp e eld of a p ersistent ob trary Op eration ob jects to b e created in the meta ject is assigned to the referredto ob ject must also level even op erations that would violate encapsu b e made p ersistent otherwise it will not b e p ossible lation can b e created and p erformed by using this to recreate the complete state of the referring ob ject interface However for the sake of security such afterwards This can b e accomplished by probing the op erations must b e created using Op erationFactory metaconguration of this ob ject with a broadcast ob jects that are given to metaob jects whenever message If no p ersistence nor identication meta they are asso ciated with an ob ject This ensures ob ject exists in the ob jects metaconguration the that only comp onent metaob jects of an ob jects ob ject must recongured so as to b ecome p ersistent metaconguration and metalevel ob jects trusted by or the eld assignment must b e denied by throwing them can obtain priviledged access to this ob ject an exception Comp osers may distribute restricted op eration facto In order to reincarnate a p ersistent ob ject there ries to metaob jects they delegate to are two p ossible approaches