COMP667 Software Fault Tolerance Aspect OPTIMA Jrg Kienzle

  • Slides: 38
Download presentation
COMP-667 Software Fault Tolerance Aspect. OPTIMA Jörg Kienzle School of Computer Science Mc. Gill

COMP-667 Software Fault Tolerance Aspect. OPTIMA Jörg Kienzle School of Computer Science Mc. Gill University, Montreal, QC, Canada With Contributions From: Samuel Gélineau, Ekwa Duala-Ekoko, Güven Bölükbaşi, Barbara Gallina COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle

Aspect Case Study: Transactions A transaction groups together a set of operations on data

Aspect Case Study: Transactions A transaction groups together a set of operations on data objects, guaranteeing the ACID properties Atomicity Consistency Isolation Durability COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 2

Recovery (Atomicity, Durability, Consistency) On transaction abort Undo the changes made on behalf of

Recovery (Atomicity, Durability, Consistency) On transaction abort Undo the changes made on behalf of the transaction Snapshot-based recovery In-place update All operations are executed on one main copy of the state of a transactional object Make a backup copy (or snapshot) before modifying Deferred update Each modifying transaction operates on a different copy Upon transaction commit, the changes are propagated to the main copy Durability requires to save all committed changes to stable storage COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 3

Transaction Models: Flat Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 4

Transaction Models: Flat Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 4

Transaction Models: Nested Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 5

Transaction Models: Nested Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 5

Transaction Models: Open Multithreaded Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 6

Transaction Models: Open Multithreaded Transactions COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 6

Aspect. J Design of Aspect. Optima In our Aspect. J implementation of Aspect. Optima,

Aspect. J Design of Aspect. Optima In our Aspect. J implementation of Aspect. Optima, an aspect encapsulates additional structure and behavior applicable to base classes Base Class base fields base methods Base Class with Aspect base fields introduced by aspect base methods intercepted by aspect methods introduced by aspect COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 7

Reusable Bindings in Aspect. J Abstract Introduction Idiom Each aspect is applied to a

Reusable Bindings in Aspect. J Abstract Introduction Idiom Each aspect is applied to a dummy interface Bindings are established by making an application class implement the dummy interface Binding can be specified using an aspect as well! COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 8

Design of Aspect. Optima 3 high-level concerns Objects Threads Contexts (or scopes of computations)

Design of Aspect. Optima 3 high-level concerns Objects Threads Contexts (or scopes of computations) We identified 12 aspects for objects, 3 for threads, and 13 for contexts Each aspect has well-defined functionality and is individually reusable Subtle dependencies and conflicts between aspects COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 9

Aspect. Optima Feature Diagram Feature diagram allows users of the framework to choose desired

Aspect. Optima Feature Diagram Feature diagram allows users of the framework to choose desired transaction configuration COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 10

Access. Classified in Aspect. J package library. aspects. object; import java. lang. reflect. Method;

Access. Classified in Aspect. J package library. aspects. object; import java. lang. reflect. Method; import library. annotations. *; import library. interfaces. Access. Classified; import library. util. Access. Types; public aspect Access. Classified. Aspect { public String Access. Classified. get. Access. Type. Of. Method (String method. Name) { String access. Type = Access. Types. WRITE; for (Method method : this. get. Class(). get. Methods()) { if ((method. Name. trim()). equals. Ignore. Case(method. get. Name())) { if(method. is. Annotation. Present(Read. Access. class)) access. Type = Access. Types. READ; else if(method. is. Annotation. Present(Update. Access. class)) access. Type = Access. Types. UPDATE; break; // If there is no annotation, assume the worst case } } return access. Type; }} COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 11

Access. Classified Bank Account import library. annotations. *; import library. interfaces. Access. Classified; public

Access. Classified Bank Account import library. annotations. *; import library. interfaces. Access. Classified; public class Account implements Access. Classified { public Account(int starting. Balance) { balance = starting. Balance; } @Read. Access public int get. Balance() { return balance; } @Write. Access public void set. Balance(int new. Balance) { balance = new. Balance; } } COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 12

Per Object Aspects Lockable: Creates lock types, gets and releases locks Access. Classified: Provides

Per Object Aspects Lockable: Creates lock types, gets and releases locks Access. Classified: Provides access kind for each method (read, write, update) Named: Associates a name (string) with each application object instance COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 13

Per Object Aspects Copyable: Provides cloning and state replacement capabilities Shared: Enforces multiple reader

Per Object Aspects Copyable: Provides cloning and state replacement capabilities Shared: Enforces multiple reader / single writer Traceable: Provides operation invocation information COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 14

Per Object Aspects Context. Aware: Informs context whenever an operation is invoked Serializable: Provides

Per Object Aspects Context. Aware: Informs context whenever an operation is invoked Serializable: Provides streaming capabilities Versioned: Creates views (separate instances of the same application object), associable to threads COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 15

Per Object Aspects Checkpointable: Establishes, restores and discards checkpoints Context. Tracking: Remembers contexts that

Per Object Aspects Checkpointable: Establishes, restores and discards checkpoints Context. Tracking: Remembers contexts that access the object Persistable: Saves and loads state from stable storage COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 16

Specifying Dependencies in Aspect. J Traceable objects have to be Access. Classified and Named

Specifying Dependencies in Aspect. J Traceable objects have to be Access. Classified and Named as well package library. aspects. object; import library. interfaces. Traceable; import library. interfaces. Named; import library. interfaces. Access. Classified; import library. util. Object. Trace; public aspect Traceable. Aspect { declare parents: Traceable implements Named, Access. Classified; public Object. Traceable. create. My. Trace(String method. Name) { String access. Type = get. Access. Type. Of. Method(method. Name); Object. Trace trace = new Object. Trace(this, access. Type); return trace; } } COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 17

Per Thread Aspects Context. Participant: Provides context creation and destruction functionality Collaborative: Provides joining

Per Thread Aspects Context. Participant: Provides context creation and destruction functionality Collaborative: Provides joining functionality and control on number of participants Outcome. Affecting: Provides opinion on outcome of the context COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 18

Per Context Aspects • Tracking: Remembers all operation invocations made on behalf of the

Per Context Aspects • Tracking: Remembers all operation invocations made on behalf of the context • Outcome. Aware: Associates success/failure outcome with a context • Pausable: Suspends participant work if needed COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 19

Dealing with Aspect Conflicts COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 20

Dealing with Aspect Conflicts COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 20

Conflict Examples Copyable ↔ Lockable Copyable ↔ Shared Serializable ↔ Named Versioned ↔ Context.

Conflict Examples Copyable ↔ Lockable Copyable ↔ Shared Serializable ↔ Named Versioned ↔ Context. Aware Versioned ↔ Persistable Checkpointable ↔ Persistable Nested ↔ Tracking Nested ↔ Deferring Nested ↔ Checkpointing Nested ↔ 2 -Phase-Locking ↔ Recovering COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 21

New Aspect. Optima Feature Diagram COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 22

New Aspect. Optima Feature Diagram COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 22

Example Configuration 1 Flat Transactions, Optimistic Concurrency Control, Deferred Update Thread: Context. Participant, Outcome.

Example Configuration 1 Flat Transactions, Optimistic Concurrency Control, Deferred Update Thread: Context. Participant, Outcome. Affecting Context: Tracking, Deferring, Outcome. Aware, Recovering Object: Context. Aware, Access. Classified, Named, Trackable, Copyable, Versioned, Persistable, Context. Tracking COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 23

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 24

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 24

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 25

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 25

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 26

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 26

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 27

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 27

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 28

Invoking an Operation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 28

Invoking an Operation 5 Interceptions 2 Interceptions of the actual method invocation 3 Interceptions

Invoking an Operation 5 Interceptions 2 Interceptions of the actual method invocation 3 Interceptions of the work operation of the context Collaboration of 11 Aspects COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 29

Operation Invocation Summary COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 30

Operation Invocation Summary COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 30

Example Configuration 2 Open Multithreaded Transactions, Pessimistic Lock-Based Concurrency Control, Inplace Update Thread: Context.

Example Configuration 2 Open Multithreaded Transactions, Pessimistic Lock-Based Concurrency Control, Inplace Update Thread: Context. Participant, Outcome. Affecting, Collaborating Context: Tracking, 2 -Phase-Locking, Checkpointing, Outcome. Aware, Recovering, Nested, Collaborative, Exit. Synchronizing, Outcome. Voted Object: Context. Aware, Access. Classified, Named, Lockable, Trackable, Copyable, Checkpointable, Shared, Persistable COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 31

An Operation Invocation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 32

An Operation Invocation COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 32

Reusable Aspect Models (RAM) • Aspect-oriented modeling approach integrating class diagrams, state diagrams and

Reusable Aspect Models (RAM) • Aspect-oriented modeling approach integrating class diagrams, state diagrams and sequence diagrams • • Aspect models can specify structure and behavior Based on existing class diagram weaving technology [France et al. ] Based on existing sequence diagram weaving technology [Klein et al. ] Template parameters borrowed from Theme-UML [Clarke et al. ] • Reusable • Modular packaging • Dependencies encapsulated and automatically resolved • Overcome complexity at modelling level Aspect-Oriented Multi-View Modeling, © 2009 Jörg Kienzle 33

Multi-View Modeling • Allows developers to describe a (software) system from multiple points of

Multi-View Modeling • Allows developers to describe a (software) system from multiple points of view • Structural views vs. behavioral views • Allows developers to use multiple modeling notations / formalisms • Makes it possible for a modeler to use the most appropriate formalism to express the facet of the system in focus • Challenges • Scalability • Consistency Aspect-Oriented Multi-View Modeling, © 2009 Jörg Kienzle 34

RAM Aspect Models • Aspect package groups structure and behavioral models related to a

RAM Aspect Models • Aspect package groups structure and behavioral models related to a concern • One structural view • One state view for each class defined in structural view • At least one message view for each public method defined in structural view aspect Context structural view A B int x, y boolean z + m 1() - m 2() state view A m 1() Any state view B bef. M m 2() aft. M message view m 1 c: Caller Aspect-Oriented Multi-View Modeling, © 2009 Jörg Kienzle target: A m 1() my. B: B m 2() 35

Consistency Checks • When creating the aspect model, consistency checks are performed among views

Consistency Checks • When creating the aspect model, consistency checks are performed among views • Standard consistency checks • Conformance between the message views and the state views (model checking). • Before (during) the weaving, consistency checks are performed among the directives defined at different levels • For structural views, bindings and instantiations defining mappings of the same structural entity must be consistent. • For state views, bindings and instantiations at a “higher” level must designate the same state or substates of the bindings of the “lower” level. • For message views, bindings at a “higher” level must match a subset of messages of the bindings of the “lower” level. • After executing the weaving, consistency checks are performed among the woven views • Conformance of the partial sequences of messages defined for each object instance in the woven sequence diagram with the protocol defined in the state view of the corresponding class (model checking) Aspect-Oriented Multi-View Modeling, © 2009 Jörg Kienzle 36

Conclusion • Reusable Aspect Models (RAM) • Aspect-oriented modeling approach integrating class diagrams, state

Conclusion • Reusable Aspect Models (RAM) • Aspect-oriented modeling approach integrating class diagrams, state diagrams and sequence diagrams • Reuse is safe (mandatory instantiation parameters) and flexible (optional bindings) • Support for elaborate dependency chains • Weaving algorithm recursively resolves dependencies to create independent final model • Elaborate consistency checks • Model-checking of conformance of sequence diagram and state diagrams Aspect-Oriented Multi-View Modeling, © 2009 Jörg Kienzle 37

Aspect. Optima References Aspect-Orientation [1] J. Kienzle, Ekwa Duala-Ekoko and S. Gélineau, “Aspect. OPTIMA:

Aspect. Optima References Aspect-Orientation [1] J. Kienzle, Ekwa Duala-Ekoko and S. Gélineau, “Aspect. OPTIMA: A Case Study on Aspect Dependencies and Interactions”, Transactions on Aspect-Oriented Software Development, vol. 5, 2008. [2] J. Kienzle and S. Gélineau, “ AO Challenge: Implementing the ACID Properties for Transactional Objects”, in Proceedings of the 5 th International Conference on Aspect-Oriented Software Development - AOSD 2006, March 20 - 24, 2006, pp. 202 – 213, ACM Press, March 2006. [3] J. Kienzle and R. Guerraoui, “ AOP - Does It Make Sense? The Case of Concurrency and Failures”, in 16 th European Conference on Object–Oriented Programming (ECOOP’ 2002), Lecture Notes in Computer Science 2374, (Malaga, Spain), pp. 37 – 61, Springer Verlag, 2002. Open Multithreaded Transactions [4] M. Monod, J. Kienzle, and A. Romanovsky, “Looking Ahead in Open Multithreaded Transactions”, in Proceedings of the 9 th International Symposium on Object and Component. Oriented Real-Time Distributed Computing, pp. 53 – 63, IEEE Press, April 2006. [5] J. Kienzle, Open Multithreaded Transactions — A Transaction Model for Concurrent Object. Oriented Programming. Kluwer Academic Publishers, 2003. COMP-667 - Aspect. OPTIMA, © 2009 Jörg Kienzle 38