520 likes | 673 Views
Abstraction of Transaction Demarcation in Component-Oriented Middleware. Romain Rouvoy - Philippe Merle Jacquard INRIA Project LIFL – USTL {Romain.Rouvoy, Philippe.Merle}@lifl.fr Second ObjectWeb Consortium conference, Paris, November 28 - 29th, 2002. Outline. Context Challenges
E N D
Abstraction of Transaction Demarcation in Component-Oriented Middleware Romain Rouvoy - Philippe Merle Jacquard INRIA Project LIFL – USTL {Romain.Rouvoy, Philippe.Merle}@lifl.fr Second ObjectWeb Consortium conference, Paris, November 28 - 29th, 2002
Outline • Context • Challenges • Solution • Current experimentations • Conclusion
Context • Under sun lights of middleware for components • Enterprise Java Beans (EJB) • CORBA Components (CCM) • Next best things as .NET, Web Services, etc. • “Container” is the key technological artifact • Transparent integration of extra functionalities • Transaction, security, persistency, server scalability, etc. • Various approaches • Generated interception code, Fractal component membranes, AOP, MOP, … • Many business components require “Transaction Demarcation (TD)” as fundamental extra functionality • All/any containers should/will address TD
EJB Transaction Demarcation EJB Container 6 TD policies: - SUPPORTS - NEVER - MANDATORY - REQUIRED - NOT SUPPORTED - REQUIRES NEW Integration already done by JOnASand any other EJB platforms Java Transaction Service (JTA)
Technical Challenge n°1 EJB Platform 6 TD policies Not done by JOnAS, is it? Few EJB platforms could do this! Object Transaction Service (OTS) Java Transaction Service (JTA) Next Best Things (e.g. JOTM)
Technical Challenge n°1 EJB Platform 6 TD policies Requires abstraction of the TM integration! Object Transaction Service (OTS) Java Transaction Service (JTA) Next Best Things (e.g. JOTM)
Technical Challenge n°2 CCM / OpenCCM EJB / JOnAS Next Best Things 6 TD policies 6 TD policies 6 TD policies Who addresses this factorization? Java Open Transaction Manager (JOTM)
Technical Challenge n°2 CCM / OpenCCM EJB / JOnAS Next Best Things Requires abstraction of the 6 TD policies! Java Open Transaction Manager (JOTM)
Technical Challenge n°3 CCM / OpenCCM EJB / JOnAS Next Best Things Abstraction of the 6 TD policies How adding new TD policies? e.g. requires new sub transaction Java Open Transaction Manager (JOTM)
Technical Challenge n°4 CCM / OpenCCM EJB / JOnAS Next Best Things Adding new TD policies e.g. requires new sub transaction Requires independence between TD and TM! Object Transaction Service (OTS) Java Open Transaction Manager (JOTM) Next Best Things (e.g. JOTM)
Scientific Challenge • Abstraction of transaction demarcation in component-oriented middleware • Mastering what transaction demarcations are • Mastering what transaction managers are • Defining the Open Transaction Demarcation Framework (OTDF)
Framework Challenge CCM / OpenCCM EJB / JOnAS Next Best Things Open Transaction Demarcation Framework (OTDF) Object Transaction Service (OTS) Java Transaction Service (JTA) Next Best Things (e.g. JOTM)
Software Challenge • Provides the Java Open Transaction Demarcation Framework (JOTDF) • Modular and extensible • Aspect- and component-oriented • Memory and CPU predictability • No performance degradation • JOTDF should include • UML diagrams • Java interfaces • Java classes • Fractal components
What is OTDF ? OTDF OTS EJB Platform ? JTS CCM Platform JOTM
Technical Challenges n°1 :Transaction Manager Abstraction OTDF OTS JTS EJB Platform Factor Point JOTM Define a logical factorization
Technical Challenges n°1 :Transaction Manager Abstraction OTDF OTS JTS EJB Platform Factor Point JOTM Need a common protocol
Wrapper Wrapper Wrapper Technical Challenges n°1 :Transaction Manager Abstraction OTDF ? OTS ? JTS EJB Platform Factor Point ? JOTM Provide a TM abstraction What is this abstraction ?
Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform 6 TD policies JTS CCM Platform 6 TD policies JOTM Extract the policies
Switch(td) { case Supports : … case Required : … case NotSupported : … case RequiresNew : … case Mandatory : … case Never : … } Technical Challenges n°2 :Transaction Demarcation Abstraction JOnAS OTDF <<interface>> TransactionPolicy Supports Required NotSupported RequiresNew Mandatory Never Command Design Pattern
Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform 6 TD policies JTS CCM Platform 6 TD policies JOTM Provide interfaces
Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform Supports JTS 6 TD Policies :- SUPPORTS - NEVER - MANDATORY - REQUIRED - NOT SUPPORTED - REQUIRES NEW Mandatory JTS Never JTS Required JTS Not Supported JTS JTS Requires New JTS 6 TD Policies :- SUPPORTS - NEVER - MANDATORY - REQUIRED - NOT SUPPORTED - REQUIRES NEW Supports OTS Mandatory OTS CCM Platform Never OTS Required OTS JOTM Not Supported OTS Requires New OTS Technical code extraction
Requires New Not Supported Required Never Mandatory Supports JTS JTS JTS JTS JTS JTS Supports Requires New Required Never Mandatory Not Supported OTS OTS OTS OTS OTS OTS Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform Supports JTS Mandatory JTS Never JTS Required JTS Not Supported JTS JTS Requires New JTS Supports OTS Mandatory OTS CCM Platform Never OTS Required OTS JOTM Not Supported OTS Requires New OTS Technical code extraction
Supports JTS Mandatory JTS Never JTS Required JTS Not Supported JTS Requires New JTS Supports OTS Mandatory OTS Never OTS Required OTS Not Supported OTS Requires New OTS Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform JTS CCM Platform JOTM Technical code extraction
Supports JTS Mandatory JTS Never JTS Required JTS Not Supported JTS Requires New JTS Supports OTS Mandatory OTS Never OTS Required OTS Not Supported OTS Requires New OTS Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform Supports Never JTS Not Supported Mandatory CCM Platform Required JOTM Requires New Technical code extraction
Supports Supports Mandatory Mandatory Never Never Required Required Not Supported Not Supported Requires New Requires New Technical Challenges n°2 :Transaction Demarcation Abstraction OTDF OTS EJB Platform JTS OTS JTS OTS JTS JTS OTS JTS OTS CCM Platform JTS OTS JOTM JTS OTS Technical code extraction
Supports Supports Mandatory Mandatory Never Never Required Required Not Supported Not Supported Requires New Requires New Technical Challenges n°2 :Transaction Demarcation Abstraction Same demarcation type OTDF OTS EJB Platform OTS ? JTS JTS CCM Platform JOTM Only demarcation code
Requires New Requires New Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS JTS Requires New JTS CCM Platform JOTM JOTM Using actual demarcation type
Requires New Requires New Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS JTS Requires New JTS CCM Platform No dependance JOTM JOTM Using actual demarcation type
Supports Supports Requires New Sub Requires New Sub Requires New Requires New Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS JTS JTS CCM Platform JOTM Defining new demarcation type
Supports Supports Requires New Sub Requires New Sub Requires New Requires New Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS JTS No dependance JTS CCM Platform JOTM Defining new demarcation type
Not Supported Not Supported Required Required Coordinator Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS Supports Mandatory Never JTS JTS CCM Platform JOTM Composing existing policies
Not Supported Not Supported Required Required Coordinator Technical Challenges n°3 :Adding new TD policies OTDF OTS EJB Platform OTS Supports Mandatory Never JTS JTS CCM Platform JOTM Composing existing policies
Supports Mandatory Never Required Not Supported Requires New Technical Challenges n°4 :Independence between TD and TM OTDF EJB Platform OTS OTS JTS ? JTS CCM Platform JOTM JOTM Only demarcation code
Supports TM TM TM Mandatory Never Required Not Supported Requires New Technical Challenges n°4 :Independence between TD and TM OTDF EJB Platform OTS OTS JTS Independence JTS JOTM CCM Platform JOTM Abstraction
TM Technical Challenges n°2 :Transaction Demarcation Abstraction public interface UserTransaction { public int get_status (); public void begin (); public void commit (); public void rollback (); public void set_rollback_only (); public void set_transaction_timeout (int seconds); } public interface TransactionManager extends UserTransaction { public Transaction get_transaction (); public Transaction suspend (); public void resume (Transaction tx); } OTS <<interface>> UserTransaction <<interface>> TransactionManager
Supports Supports TM TM TM Mandatory Mandatory Never Never Required Required Not Supported Not Supported Requires New Requires New Technical Challenges n°4 :Independence between TD and TM OTDF CCM Platform OTS OTS JTS JTS JOTM EJB Platform JOTM Instance
Supports TM TM TM Mandatory Never Required Not Supported Requires New New Technical Challenge :Organisation of the TD OTDF OTS OTS Organization ? JTS JTS JOTM JOTM How to structure the policies ?
Supports Mandatory Never Required Not Supported Requires New New Technical Challenge :Organization of the TD Interrogation Interruption Activation • No hierarchy/organization in the policies ! • Observing policies to define a structure • Mapping between policies and the structure
TM TM TM New Technical Challenge :Organization of the TD OTDF Supports OTS Domain OTS ? Mandatory Interrogation Never Interrogation JTS JTS Activation Required Interruption Not Supported JOTM JOTM Requires New Activation Interruption
New Technical Challenge :Organization of the TD <<interface>> DomainProtocol public interface DomainInterrogation extends DomainProtocol { public int get_status(RequestCallContext ctx) ; } public interface DomainActivation extends TransactionStatus { public void begin(RequestCallContext ctx) ; public void commit(RequestCallContext ctx) ; } public interface DomainInterruption extends TransactionStatus { public void suspend(RequestCallContext ctx) ; public void resume(RequestCallContext ctx) ; } <<interface>> DomainInterrogation <<interface>> DomainActivation <<interface>> DomainInterruption
TM TM TM New Technical Challenges :Organization of the TD OTDF TD Domains TM Supports OTS OTS Domain Mandatory Interrogation Never JTS JTS Activation Required Interruption Requires New JOTM JOTM Not Supported
New Technical Challenges :Organization of the TD ActivationPolicy public class RequiredPolicyImpl extends AbstractActivationPolicy implements RequiredPolicy { public RequiredPolicyImpl(TransactionActivation ta) { super(ta); } public void preinvoke(RequestCallContext ctx) { if (ta.get_status(ctx)==Status.STATUS_NO_TRANSACTION) ta.begin(ctx); } public void postinvoke(RequestCallContext ctx) { ta.commit(ctx); } } <<abstract>> ActivationPolicyImpl <<interface>> RequiredPolicy RequiredPolicyImpl
Supports TM TM TM Mandatory Mandatory Mandatory Organisation Requires New Requires New Requires New Never Never Never Adaptability Configuration Required Required Required Not Supported Not Supported Not Supported Extensions The ODTF Framework OTDF Domain Interrogation OTS Activation Interruption Domain Multi-Transaction Manager Multi-plateform Interrogation JTS Activation Interruption Domain Interrogation JOTM Activation Interruption
Class Evaluation • Before (without ODTF) • Nb Classes = Nb TD x Nb TM • E.g. = 6 TD x 3 TM = 18 Classes • After (with ODTF) • Nb Classes = Nb TD + Nb Domaines + Nb TM • E.g. : 6 TD + 3 Domains + 3 TM = 12 Classes
Context of the experimentation • Specifications : • Computer : • Type : DELL Optiflex GX240 • CPU : Intel Pentium 4 2.00GHz • RAM : 1024 Mo • Bogomips : 3971.48 • OS : Linux Debian • Kernel : 2.4.19-686 • JDK: • Version : 1.4.1_01 • JOnAS : • Version : 2.5.3 (from CVS) • JOTDF : • Using Fractal : no • Framework Level : 2
Context of the experimentation • Experimentation : • JOnAS example : sb • Invocation : method buy() • Type : • 1000 invocations inside a transaction • 1000 invocations outside a transaction • Measure : • global execution time • number : • 10 on JOnAS platform • 10 on JOnAS platform with JOTDF
Supports Mandatory Requires New Never Required Not Supported The JOnAS’s JODTF Framework JOTDF JTS JOnAS (EJB) Platform JTS Interrogation Activation Interruption
Conclusion • We could abstract transaction demarcation in middleware platforms for components with high added values • Modular and extensible • Aspect- and component-oriented • Better memory and CPU predictability • No performance degradation • The framework and its code base are available • UML diagrams • Java interfaces and classes • Fractal components • Seamless JOnAS integration done • By removing transactional code in JOnAS ;-) • By adding adaptation code for our framework ;-( • Better integration = Think JOnAS containers as clients of our framework