160 likes | 296 Views
AOP: Does It Make Sense? The Case of Concurrency and Failures. Sibylle Aregger & Antonia Schmidig. Presentation based on. by Jörg Kienzle and Rachid Guerraoui. NO!. The Problem . aspectizing Concurrency and Failures AspectJ & Transactions aspectize transaction semantics
E N D
AOP: Does It Make Sense?The Case of Concurrency and Failures Sibylle Aregger & Antonia Schmidig Presentation based on by Jörg Kienzle and Rachid Guerraoui
NO! SS 2004
The Problem • aspectizing Concurrency and Failures • AspectJ & Transactions • aspectize transaction semantics • aspectize transaction interfaces • aspectize transaction mechanisms SS 2004
Overview • Transactions • AOP (Aspect Oriented Programming) • aspectize transaction semantics • aspectize transaction interfaces • aspectize transaction mechanisms • Conclusion SS 2004
Transactions • ACID • Serializability • Concurrency • Failure Recovery => fundamental paradigm to handle Concurrency and Failures SS 2004
AOP • separation of concerns-> separate code (aspect) • WeavingCode + Aspect(s) = Program SS 2004
AOP: Example • [Picture: Figure/Point/Line Example] SS 2004
AOP: JoinPoint • JoinPoint: • point in flow of program • „hook“ to insert aspect-code Program Flow JoinPoint Method SS 2004
AOP: PointCut • PointCut: • set of JoinPoints pointcut moves(): receptions(void Line.setP1(Point)) || receptions(void Line.setP2(Point)) || receptions(void Point.setX(int)) || receptions(void Point.setY(int)); SS 2004
AOP: Advice • Before • After • Around Program Flow JoinPoint Method SS 2004
AOP: Example aspect MoveTracking { static boolean flag = false; static boolean testAndClear() { boolean result = flag; flag = false; return result; } pointcut moves() : ... after() : moves() { flag = true; } } SS 2004
Aspectize Transaction Semantics • combine non-transactional code with transaction aspects • problems: • irreversible actions • deadlock SS 2004
T1: A.deposit(Amount) while (B.getBalance() <= Amount) {} B.withdraw(Amount) T2: B.deposit(Amount) while (A.getBalance() <= Amount) {} A.withdraw(Amount) ATS: Unsolvable Deadlock • Problem: linearizability serializability • Solution: multithreaded transactions • New Problem: automatic detection of cooperating threads SS 2004
Aspectize Transaction Interfaces SS 2004
Aspectize Transaction Mechanisms SS 2004
Conclusion • aspectize transaction semantics:not possible • aspectize transaction interfaces:possible, but artificial • aspectize transaction mechanisms:only syntactical separation SS 2004