Refactoring Long Running Transactions: A Case Study



Similar documents
Concept and Experiences on using a Wiki-based System for Software-related Seminar Papers

Chapter 3 Savings, Present Value and Ricardian Equivalence

Over-encryption: Management of Access Control Evolution on Outsourced Data

Model-Driven Engineering of Adaptation Engines for Self-Adaptive Software: Executable Runtime Megamodels

Software Engineering and Development

HIGH AVAILABILITY SOLUTION: RESOURCE USAGE MANAGEMENT IN VIRTUALIZED SOFTWARE AGING

9:6.4 Sample Questions/Requests for Managing Underwriter Candidates

Give me all I pay for Execution Guarantees in Electronic Commerce Payment Processes

Cloud Service Reliability: Modeling and Analysis

Comparing Availability of Various Rack Power Redundancy Configurations

The Role of Gravity in Orbital Motion

An Approach to Optimized Resource Allocation for Cloud Simulation Platform

AN IMPLEMENTATION OF BINARY AND FLOATING POINT CHROMOSOME REPRESENTATION IN GENETIC ALGORITHM

An Efficient Group Key Agreement Protocol for Ad hoc Networks

Firstmark Credit Union Commercial Loan Department

Electricity transmission network optimization model of supply and demand the case in Taiwan electricity transmission system

Automatic Testing of Neighbor Discovery Protocol Based on FSM and TTCN*

Comparing Availability of Various Rack Power Redundancy Configurations

Continuous Compounding and Annualization

PAN STABILITY TESTING OF DC CIRCUITS USING VARIATIONAL METHODS XVIII - SPETO pod patronatem. Summary

Top K Nearest Keyword Search on Large Graphs

ON THE (Q, R) POLICY IN PRODUCTION-INVENTORY SYSTEMS

STUDENT RESPONSE TO ANNUITY FORMULA DERIVATION

College of Engineering Bachelor of Computer Science

HEALTHCARE INTEGRATION BASED ON CLOUD COMPUTING

Spirotechnics! September 7, Amanda Zeringue, Michael Spannuth and Amanda Zeringue Dierential Geometry Project

ENABLING INFORMATION GATHERING PATTERNS FOR EMERGENCY RESPONSE WITH THE OPENKNOWLEDGE SYSTEM

Towards Automatic Update of Access Control Policy

Optimal Peer Selection in a Free-Market Peer-Resource Economy

Channel selection in e-commerce age: A strategic analysis of co-op advertising models

Converting knowledge Into Practice

Office of Family Assistance. Evaluation Resource Guide for Responsible Fatherhood Programs

Things to Remember. r Complete all of the sections on the Retirement Benefit Options form that apply to your request.

est using the formula I = Prt, where I is the interest earned, P is the principal, r is the interest rate, and t is the time in years.

Chris J. Skinner The probability of identification: applying ideas from forensic statistics to disclosure risk assessment

Debt Shifting in Europe

Modeling and Verifying a Price Model for Congestion Control in Computer Networks Using PROMELA/SPIN

Power Monitoring and Control for Electric Home Appliances Based on Power Line Communication

An application of stochastic programming in solving capacity allocation and migration planning problem under uncertainty

Instructions to help you complete your enrollment form for HPHC's Medicare Supplemental Plan

The transport performance evaluation system building of logistics enterprises

Data Center Demand Response: Avoiding the Coincident Peak via Workload Shifting and Local Generation

Uncertain Version Control in Open Collaborative Editing of Tree-Structured Documents

Reduced Pattern Training Based on Task Decomposition Using Pattern Distributor

A framework for the selection of enterprise resource planning (ERP) system based on fuzzy decision making methods

Multicriteria analysis in telecommunications

2 r2 θ = r2 t. (3.59) The equal area law is the statement that the term in parentheses,

An Analysis of Manufacturer Benefits under Vendor Managed Systems

Gravitational Mechanics of the Mars-Phobos System: Comparing Methods of Orbital Dynamics Modeling for Exploratory Mission Planning

Effect of Contention Window on the Performance of IEEE WLANs

Multiband Microstrip Patch Antenna for Microwave Applications

Chapter 2 Valiant Load-Balancing: Building Networks That Can Support All Traffic Matrices

Optimizing Content Retrieval Delay for LT-based Distributed Cloud Storage Systems

UNIT CIRCLE TRIGONOMETRY

Scheduling Hadoop Jobs to Meet Deadlines

Efficient Redundancy Techniques for Latency Reduction in Cloud Systems

Towards Realizing a Low Cost and Highly Available Datacenter Power Infrastructure

Methods for the specification and verification of business processes MPB (6 cfu, 295AA)

Real Estate Equity Derivatives

Database Management Systems

A Capacitated Commodity Trading Model with Market Power

The force between electric charges. Comparing gravity and the interaction between charges. Coulomb s Law. Forces between two charges

Transmittal 198 Date: DECEMBER 9, SUBJECT: Termination of the Existing Eligibility-File Based Crossover Process at All Medicare Contractors

Semipartial (Part) and Partial Correlation

Loyalty Rewards and Gift Card Programs: Basic Actuarial Estimation Techniques

Faithful Comptroller s Handbook

Advanced Control of Active Filters. in a Battery Charger Application. Martin Bojrup

Financial Derivatives for Computer Network Capacity Markets with Quality-of-Service Guarantees

A Study on the Conducted Interference of Capacitor Charging Power Supply

How to recover your Exchange 2003/2007 mailboxes and s if all you have available are your PRIV1.EDB and PRIV1.STM Information Store database

An Introduction to Omega

Referral service and customer incentive in online retail supply Chain

Promised Lead-Time Contracts Under Asymmetric Information

Valuation of Floating Rate Bonds 1

How To Find The Optimal Stategy For Buying Life Insuance

A formalism of ontology to support a software maintenance knowledge-based system

The Supply of Loanable Funds: A Comment on the Misconception and Its Implications

CANCER, HEART ATTACK OR STROKE CLAIM FORM

METHODOLOGICAL APPROACH TO STRATEGIC PERFORMANCE OPTIMIZATION

Confirmation of Booking

Review Graph based Online Store Review Spammer Detection

Tracking/Fusion and Deghosting with Doppler Frequency from Two Passive Acoustic Sensors

THE DISTRIBUTED LOCATION RESOLUTION PROBLEM AND ITS EFFICIENT SOLUTION

Approximation Algorithms for Data Management in Networks

How Much Should a Firm Borrow. Effect of tax shields. Capital Structure Theory. Capital Structure & Corporate Taxes

Distributed Computing and Big Data: Hadoop and MapReduce

Questions & Answers Chapter 10 Software Reliability Prediction, Allocation and Demonstration Testing

arxiv: v1 [q-fin.st] 12 Oct 2011

INITIAL MARGIN CALCULATION ON DERIVATIVE MARKETS OPTION VALUATION FORMULAS

COMPLYING WITH THE DRUG-FREE SCHOOLS AND CAMPUSES REGULATIONS

Optimal Capital Structure with Endogenous Bankruptcy:

Dual channel closed-loop supply chain coordination with a reward-driven remanufacturing policy

How To Use A Network On A Network With A Powerline (Lan) On A Pcode (Lan On Alan) (Lan For Acedo) (Moe) (Omo) On An Ipo) Or Ipo (

APPLICATION AND AGREEMENT FORM FOR TELECOMMUNICATION SERVICES BUSINESS APPLICATION

IBM Research Smarter Transportation Analytics

Research and the Approval Process

Memory-Aware Sizing for In-Memory Databases

Integrating Net2 with an intruder alarm system

High Availability Replication Strategy for Deduplication Storage System

Financial Planning and Risk-return profiles

Transcription:

Reactoing Long Running Tansactions: A Case Study Gianluigi Feai 1, Robeto Guanciale 1, Daniele Stollo 1, and Emilio Tuosto 2 1 Dipatimento di Inomatica, Univesità degli Studi di Pisa, Italy {giangi,guancio,stollo}@di.unipi.it 2 Univesity o Leiceste, Compute Science Depatment Univesity Road, LE17RH, Leiceste, UK et52@mcs.le.ac.uk Abstact. Managing tansactions is a key issue in Sevice Oiented Computing whee paticula elevance is given to the so called Long Running Tansactions (LRT). Hee, we show how to apply a omal appoach to the speciication and eactoing o LRT. Speciically, we conside a methodology aising on pocess calculi and show how it can be applied to a case study. 1 Intoduction Sevice Oiented Computing (SOC) envisages systems as combination o basic computational entities, called sevices, whose inteaces can be dynamically published and bound. Abstact composition/coodination mechanisms ae necessay as SOC systems ae typically executed on ovelay netwoks, namely inte-netwoked communication inastuctues (e.g., wied and wieless netwoks, telecommunication netwoks o thei combination). Such abstact mechanisms ae divided in to ochestation and choeogaphy. Sevices ae ochestated when thei execution wok-low is descibed though an extenal pocess, called ochestato. Achoeogaphy speciies how sevices should be connected and inteact so to accomplish the oveall choeogaphy goals. Roughly, choeogaphies yield an abstact global view o SOC systems that must eventually be pojected on the distibuted components. In this pape, we apply the theoy deined in [4] to a case study taken om the SEN- SORIA poject [9]. Moe pecisely, in [4] it is shown how Long Running Tansactions (LRT) can be eactoed in a semantially sound way, namely a ew eactoing ules o LRT ae given and poved to peseve (weak) bisimilaity. An oiginal contibution o this pape is the desciption o ou methodology via an implemented pogamming amewok, called ESC, based on the pocess calculi used in [4]. Ou methodology consists o the ollowing steps: 1. the sotwae achitect designs the LRT model in a semiomal notation (in this pape we adopt BPMN [8,10]); 2. pogammes poduce an initial implementation o the model in SCL, the pogamming language eatued by ESC; 3. the initial implementation is eactoed by epeatedly applying eactoing ules that automatically tansom the implementation in an equivalent one. M. Wising, M. Homann, and A. Rauschmaye (Eds.): TGC 2010, LNCS 6084, pp. 318 334, 2010. Spinge-Velag Belin Heidelbeg 2010

Reactoing Long Running Tansactions: A Case Study 319 The eactoing in the last step is applied accoding to the model-diven appoach and allows the initial implementation to be adapted to choices/changes that may aise in a late stage o the development. Fo instance, the initial implementation can be given ignoing the execution platom; eactoing ules will then be applied to adapt the code to the undelying platom. Notice that this allows changes to the code to be done automatically o instance when the execution platom is decided o when it changes ate the deployment. Remakably, the adoption o the ESC amewok elieves sotwae achitects and pogammes om the inticacies o the theoetical backgound. The ESC amewok and its theoetical oundation guaantee the coectness, namely that eactoed SCL code is equivalent to the initial implementation. Synopsis. The ESC development amewok on its undelying model ae descibed in 2;theSCL language is intoduced in 3; the SENSORIA case study and the LRT eactoing ules ae discussed in 4; the action o the eactoing ules on SCL code is given in 5; inal emaks ae in 6. 2 Backgound We summaise the main ingedients o ou amewok illustated in Figue 1 whee ESC (let block), SC (middle block), and NCP (ight block) ae espectively a pogamming platom, its undelying omal model, and the choeogaphy model all elying on event notiication as the basic coodination paadigm. The Event-based Sevice Coodination (ESC) platom povides a set o Eclipse plugins that oe a gaphical and a textual epesentation o netwoks and is detailed below. Tansactions Saga ESC Platom SCL / SCDesigne SCL / SCDesigne SCL / SCDesigne Signal Calculus (SC) Signal Calculus (SC) Signal Calculus (SC) - Conomance - Bisimulation - Choeogaphy model NCP Fomal Model Java Code Deployment Java Signal Coe Laye Reinement Implementation Model Tansomation Fig. 1. ESC achitectue

320 G. Feai et al. The Signal Calculus [5,3] (SC) yields a set o coe pimitives suitable and plays the key ole o intemediate meta-model with espect to the othe two layes. The calculus o Netwok Coodination Policies [1] (NCP) extends and equips ou amewok with a choeogaphymodel. In Figue 1, the acs om SC to NCP epesent the possibility to map SC models on NCP so that the conomance to SC designs can be veiied. The ESC amewokelies on JSCL (a set ojava API ealising SC) andoestwo dieent pespectives o the netwok. The gaphical epesentation pesents a global view o the choeogaphy by consideing the components and thei inteconnections, without detailing thei intenal logics. The textual notation oes a close view o components allowing designes to ocus on the behavioal aspects. In a model diven metapho, the aspects teated at these dieent levels o abstaction shae a common meta-model. In this way a level can be easily tansomed into anothe so that the esulting taget model can be used o automatically geneating (executable) JSCL code. In act, the ESC platom supplies a set o model tansomation tools that, stating om the high level speciications (c. blocks BPMN tansactions and UML4SOA [11] in Figue 1), automatically build thei coesponding epesentation in the SCL model. The event-notiication model eatued by SCL is based on components that asynchonously emit typed events; events ae called signals and thei types ae called topics. A component may eact to signals though eactions installed in thei inteace; each eaction has an associated behaviou executed when a signal tiggeing the eaction is eceived. Additionally, events ae associated with sessions allowing to distinguish the dieent woklows. Intuitively, a session yields a vitual communication link among distibuted components. Sessions ae tanspaent to pogammes and have a scope (i.e., the components paticipating in some inteactions) that ae dealt with by the SCL semantics. In othe wods, the semantics o SCL guaantees that components outside the scope o a session do not eact to the events elated to such session. 3 Signal Coe Language The textual epesentation suppoted by ESC is the Signal Coe Language (SCL)implemented as a textual plug-in o Eclipse 1. An SCL model deines a netwok by aggegation o components, descibed in tems o eactive sotwae modules declaing the class o events they ae inteested to and the way they eact at the occuence o events. An example o SCL netwok is in Code 1.1 (whee ellipses stand o immateial code); the netwok consists o components a (LINES 3-20) and b (LINES 21-26). Topic names can be declaed eithe esticted o (LINE 1andLINE 2). A component has to declae its intention to ee a esticted name using the declaation knows (e.g., a on LINE 6). Instead, global names can be eeed by all components in the netwok. Moeove, topic names can be declaed local (LINE 4) o duing in the body o a component though the pimitive with (LINE 17). Similaly, component names can be declaed esticted by tagging components with the potected clause (LINE 21). 1 The textual edito has been implemented by using OpenAchitectueWae (oaw) [7], a modula MDA/MDD geneato amewok and suppots code completion, eo checking and code geneation.

Reactoing Long Running Tansactions: A Case Study 321 1 esticted: s1,s2; 2 global: t1, t2, t3; 3 component a { 4 local: lt1, lt2; 5 lows: [t1->a], [lt1->b]; 6 knows: s1,b; 7 eaction lambda (t1@ws){ 8 addflow ([ws->b]); 9 addreaction ( 10 eaction check (lt1@lt2){ 11 emit (t1@lt1); 12 } 13 ); 14 nop; 15 do... o... 16 split...... 17 with (nlt1)... 18 skip; 19 } 20 } 21 potected component b { 22 knows: s1; 23 main { 24... 25 } 26 } Code 1.1: An SCL netwok o two components Besides local names, components declae topics o thei lows (LINE 5) and eactions. The lows o a component speciy whee the signals have to be outed (e.g., signals o topic lt1 emitted by a ae ooted towads b). Reactions speciy what signals a component can eact to and the coesponding code to be executed upon eaction. Thee ae two kind o eaction; a eaction lambda, activated o a topic egadless its elated session, and eaction check, tiggeed only within a speciic session. Fo instance, a eacts to any signal on topic t1 (LINE 7) while can eact to signals on topic lt1 only i they ae elated to session lt2 (see LINE 10). The computational steps descibed inside eactions, declae thei behavios. The basic pimitives ae emit (LINE 11), used to send out notiication o an occued event, addflow (LINE 8) and addreaction (LINE 9) that allow lows and eactions o a component to be dynamically updated, nop (LINE 14) to indicate a block o code extenally deined though host language instuctions that do not inteee the coodination pattens (e.g. the access to the database), skip (LINE 18) epesents the empty action (the SC silent action).

322 G. Feai et al. Futhemoe, behavios can be composed in sequence (using, as usual the semicolon) o with do-o (LINE 15) and split (LINE 16) constucts. The ome constucts is used to implement the non deteministic execution o two banches, the latte allows the paallel composition o two behavioal activities. Notice that componentb declaesa main block (LINES 23-25) that speciies its initial behavio. 4 A Case Study: The Ca Repai Scenaio We apply ou methodology to the SENSORIA automotive case study [11] and show how it can be developed in the ESC amewok. We biely descibe the case study. A ca manuactue oes a sevice that, once a use s ca beaks down, the system attempts to locate a gaage, a tow tuck and a ental ca sevice so that the ca is towed to the gaage and epaied meanwhile the ca owne may continue his tavel. The ollowing equiements ae speciied: beoe any sevice lookup is made, an amount o money is eseved on the use s cedit cad; beoe looking o a tow tuck, a gaage must be ound as it poses additional constaints to the candidate tow tucks; i no tow tuck is ound, the gaage booking must be evoked; i a ca ental (with an available ca) is ound succeeds while the seach o eithe a tow tuck o a gaage ails, the ca ental must be ediected to the boken down ca s actual location; the ailue o the seach o a ca ental should not aect the tow tuck and gaage booking. Such equiements impose the adoption o LRT as coodination with compensations is needed; also it is woth pointing out some peculiaities o the scenaio. The application consists o dieent sevices that dynamically edeate in ode to povide new unctionalities. Speciically, sevices (e.g., inancial institutions, gaages and ca ental o taxi companies) team up to help the custome. This sevice composition is dynamic and cannot be anticipated in the code. Moeove, the scenaio equies distibuted tansactional behavio to be dealt with. In act, inteactions among sevices can ail o many easons and, o couse, the custome should not be chaged when the sevice cannot be povided. Finally, SOC systems usually have to be deployed on heteogeneous platoms and have to be executed on ovelay computes, namely netwoks o many dieent kinds (e.g., wied netwoks, wieless ones o, telecommunication netwoks). Fo instance, the caepai scenaio equies sotwae inteacing GPRS system, mobile phone, the Intenet, and dedicated netwoks o inancial tansactions. The complexity o such applications equies in act a athe sophisticated development methodology that can help pogammes in acing the complexity o undelying and platom speciic aspects. The LRT gaphical model o this scenaio is pesented in Figue 2 (see Appendix A o an oveview o LRT). The model exploits the tansactional and compensation acilities o LRT; o instance, the ca ental sevice is a sub-tansaction, since (as equied) it does not aect othe activities.

Reactoing Long Running Tansactions: A Case Study 323 Chage CeditCad Ode Gaage Appointment Ode Tow Tuck Revoke Chage Cancel Gaage Appointment Cancel Tow Tuck Ode Rental Ca + Rediect Rental Ca Fig. 2. Ca epai scenaio: the LRT model Notice that initial design in Figue 2 simply descibes the tansactional aspects o the main activities. In this phase, it is not elevant to descibe sevice distibution o (eined decomposition o the main activities). 4.1 LRT to SCL Model Tansomation The ESC platom comes up with a set o tools that pemit to tansom the platom independent LRT models to the platom speciic SCL models. The SCL implementation o tansactional behavios exploits two public names, and, espectively o owad and ollback events. Fowad events popagate the successul completion om an activity to the next ones in the wok-low. Backwad events ae emitted on ailues to tigge compensations. In the ist step the model tansomation geneates an SCL component o evey atomic pocess (aka an activity and the coesponding compensation). Subsequently, the model tansomation can geneate glue components and update the existing lows, howeve the behavio o components geneated in the pevious steps cannot be alteed. This pemits to tansom a tansactional pocess to an SCL netwok independently by the context, and euse it as building block just changing its connections (SCL lows). The SCL snippets pesented in the ollowing contain unspeciied behavio which is speciic to the application (epesented with comments in the code); this missing behavious ae supposed to be added by the pogammes once the SCL code is compiled into JSCL API (e.g. Java). Atomic pocess. Figue 3(a) gives a pictoial intuition o the intenal stuctue o atomic pocesses; Figue 3(b) illustates a black-box view o atomic pocesses whee solid (esp. dashed) aows epesent the owad (esp. backwad) low o LRT; inally, the sequential composition o a and b thei owad and backwad lows as in Figue 3(c).

324 G. Feai et al. Main Activity ex emit ok install compensation & emit (b) (a) Intenal view o atomic pocess (c) Fig. 3. Atomic and sequential compensatable pocesses In Code 1.2 we epot the SCL coding o tansactional activity GARAGE whee (accoding to Figue 3(a)) two pivate topics, ok and ex, (LINE 2) ae declaed so to be able to detemine the temination o the main activity o the component. Notice that all events on topics ok and ex ae deliveed to GARAGE itsel (LINE 3). Initially the component can eact only to events (BLOCK 5-24). When eacting to owad events (signals on topic ), GARAGE eceives the session identiie s and execute the behavio coesponding to the LRT main activity (LINE 7). Such behavio is not explicitly 1 component gaage { 2 local: ok, ex; 3 lows: [(ok->gaage), (ex->gaage), 4 (->ceditcad), (->dispatchepa )]; 5 eaction lambda (@s) { 6 split { 7 /* coding o the main activity */ 8 do {emit <ok@s >;} o {emit <ex@s >;} 9 } { 10 addreaction (eaction check (ok@s) { 11 split { 12 emit <@s >; 13 } { 14 addreaction (eaction check (@s) { 15 /* Compensation */ 16 emit <@s >; 17 }); 18 } 19 }); 20 } { 21 addreaction (eaction check (ex@s) { 22 emit <@s >; 23 }); 24 } 25 } Code 1.2: SCL compensatable activity

Reactoing Long Running Tansactions: A Case Study 325 given, it is just assumed to issue an ok event on successul temination and send an ex event othewise. Concuently with the main activity GARAGE installs a eactions to check when the main activity teminates (BLOCKS 10-19 and 21-23). On successul temination (LINE 10), a signal on topic is popagated (LINE 12) and a check eaction waiting o a possible ollback is installed (LINE 14-17); when a event o the session s aives, the activity is compensated (abstacted by nop on LINE 15) and the ollback signal popagated to pevious stages (LINE 16). I the execution o the activity ails (LINE 21), the handle simply stats the backwad low, aising a ollback event (LINE 22). Since the tansomation o an atomic task geneates only one SCL component, this component is both the enty point and the exit point o the geneated netwok. Notice that the geneated component has only low to itsel, since it is geneated independently by the context. Paallel composition. The paallel composition o two LRT pocesses a and b is epesented in Figue 4(a) whee two additional components d and c epesent the dispatche and collecto. A dispatche popagates the owad lows to all the components executed in paallel and popagates the backwad lows to the pevious stage o the woklow. Similaly, the collecto waits o the outcome o each paallel component beoe popating the owad low and send ollback signals when subsequent stages o the woklow ail. The SCL code o dispatche is Code 1.3 and 1.4, espectively. Such code is geneated o the paallel composition o the TOWTRUCK and RENTALCAR sevices. The dispatche (c.. Code 1.3) epesents the enty point o the paallel banch. Basically, it activates the owad low o next components, and synchonizes thei backwad lows. Upon eactions to owad events (LINE 4), the collecto emits two events: one having topic (LINE 6) and the othe one having topic n (LINE 8). The ome event is deliveed to the components epesenting the paallel activities. The latte event is deliveed to the collecto, inoming it o the eceived session that will be late used by it to implement its synchonization. Concuently, the collecto activates its the synchonization mechanism by installing two nested eactions o the topic in the wok-low session s (LINES 10 and 11). When the synchonization o the backwad low takes place, the emitte backwadly owads the ollback event (LINE 12). (a) (b) Fig. 4. Paallel composition and tansactional enclosue

326 G. Feai et al. 1 component dispatchepa { 2 lows: [->towtuck],[->dispatchetans ], 3 [->gaage],[n->collectopa ]; 4 eaction lambda (@s) { 5 split { 6 emit (@s); 7 } { 8 emit (n@s); 9 } { 10 addreaction (eaction check (@s) { 11 addreaction (eaction check (@s) { 12 emit (@s); 13 }); 14 }); 15 } 16 } 17 } Code 1.3: SCL paallel dispatche 1 component collectopa { 2 lows: [->towtuck],[->collectotans ],[->...]; 3 eaction lambda (n@s) { 4 addreaction check (@s) { 5 addreaction check (@s) { 6 split { 7 emit <@s >; 8 } { 9 addreaction check (@s) { 10 emit <@s >; 11 } 12 } 13 } 14 } 15 } 16 } Code 1.4: SCL paallel collecto Similaly, the collecto component (in Code 1.4) is esponsible to implement the synchonization mechanism o the owad lows (LINES 4 and 5) and to activate the backwad lows o the paallel components when a event is eceived (BLOCK 9-11). Once both the intenal components have sent thei owad messages, the collecto sends out a event (LINE 7). Notice that the collecto exploits a n event to get inomation about the session s o the wok-low (LINE 3). Ate the geneation o the new components, the lows o the two netwoks ae updated (the low o in LINE 2). Moeove

Reactoing Long Running Tansactions: A Case Study 327 the backwad low is suitable connected to the intenal paallel components as given in LINE 2). The dispatche and the collecto components epesent the enty and exit point o the paallel component, espectively. Isolated tansaction. The intended meaning o tansactional enclosue constuct is that its intenal ailue does not aect othe activities. Fo this eason, egadless the outgoings o a tansactional activity a (see Figue 4(b)) the collecto will eceive a notiication o owad event ( ). The Not agent ensues that ollback equests om a ae conveted into owad equests so that the low is passed to the next stages o the tansaction. Convesely, i om the outside c eceives a ollback, the component a must be inomed and activate its compensation. Two cases ae possible: i) a has peviously successul teminated, so it has a compensation installed ii) a intenally ailed and no compensations ae needed. On its tun, d has to consume two instances o events beoe activating the backwad low while c, o the same session, consumes only a event and ignoes the uthe instances o. Similaly to the paallel encoding peviously exposed, the topic n is used om d to inom c that a new wok-low instance has been initiated so that the latte component can install the pope check eactions to consume two distinct instances o events coming om a. The geneated SCL code o the sub-tansaction containing the RENTALCAR component is povided by thee intenal components accoding to the schema given in Figue 4(b). The DISPATCHERTRANS (c.. Code 1.5) eceives om the extenal activities the owad events (LINE 3), inoms the COLLECTORTRANS that a new tansactional session has been initiated (LINE 4), ediects the owad event to the RENTALCAR (LINE 5) and installs the ollback handle o the cuent session (BLOCK 6-10). Notice that, the ollback will be sent out (LINE 8) ate the eception o two notiications. 1 component dispatchetans { 2 lows [n->collectotans ],[->RentalCa]; 3 eaction lambda (@s) { 4 emit (n@s); 5 emit (@s); 6 addreaction (eaction check (@s){ 7 addreaction (eaction check (@s){ 8 emit (@s); 9 }); 10 }); 11 } 12 } Code 1.5: SCL tansactional enclosue dispatche

328 G. Feai et al. 1 component Not { 2 lows [->collectotans ]; 3 eaction lambda (@s) { 4 emit <@s >; 5 } 6 } Code 1.6: SCL tansactional enclosue not The NOT pot has the obvious meaning, it invets the topic om to, without alteing the session, as given in Code 1.6. 1 component collectotans { 2 lows: [->collectopa],[->rentalca], 3 [->dispatchetans ]; 4 eaction lambda (n@s) { 5 addreaction( eaction check (@s) { 6 emit(@s); 7 addreaction (eaction check (@s) { 8 emit (@s); 9 }); 10 }); 11 } 12 } Code 1.7: SCL tansactional enclosue collecto The COLLECTORTRANS (c.. Code 1.7) waits until the dispatche communicates the new woking session (LINE 4). Consequently, it installs the handle o the notiications coming om the RENTALCAR (BLOCK 5-10). Once eceived the eventitis deliveed outside (LINE 6) and an handle o the ollback coming om the outside is installed (BLOCK 7-9). 5 Scl Model Reactoing In 4.1 we have shown how to compile BPMN diagams into SCL netwoks. Aguably, a simila mapping can be given also o othe omalisms o LRT as [11]. Nevetheless, the automatically geneated models may equie some modiications eithe (i) toeine the code to conside those aspects not addessable in LRT (e.g., platom dependent issues) o (ii) to optimise the geneated code. Figue 5 pictoially epesents the stuctue o the coding automatically geneated by SCL to be subsequently eined to bette adhee to additional equiements that ae

Reactoing Long Running Tansactions: A Case Study 329 Fig. 5. A epesentation o the netwok geneated in SCL not taken into account at abstact level. Fo instance, the component distibution on the netwok, ae not explicitly modeled at highe levels o abstaction, both at omal and speciication levels. In act, eithe LRT meta-models ae not concened with such aspects o, moe pagmatically, they can moe suitably consideed at late stages o the development. Fo example, BPMN designs sketches how the oveall tansaction among tansactional components should poceed without making any uthe assumption on which sevices implement such components (o whee they ae located). A possible solution to the poblem descibed abovev is to eineme the code. The einement pocess has to povide sound eactoing ules as those intoduces in [4] and adopted hee. Ou tanslation o LRT into SCL models povides the suitable level o abstaction to which these eactoing steps can be applied. Fo example, deployment o distibuted components o eaangement o points o contol can be automatically tansomed at the SCL level especting the oiginal semantics o automatically tanslated designs. 5.1 Reactoing Tansactional Components The ist eactoing ule consists in delegating the compensation o SCL tansactional components; the ule is applied to the GARAGE (c. Code 1.2, 4.1). As aleady pointed out, both the main activity and the compensation o a tansactional component ae embedded into a single SCL component that manages ok and ex events in ode to popagate owad o backwad lows. Howeve, it might be useul to delegate the compensation task to a dieent component. Fo example, the compensation should un on a dieent host than the main activity, because it involves a emote sevice. Usually, this aspect is not speciied in the model o the business pocess. In the ESC amewok, this issue can be tackled at deployment time, indeed implementation o JSCL [5] pemits to othogonally distibute components on the netwok topology. The eactoing ule geneates a component, called CMP (Code 1.8, lines 20-29), that handles the compensation managing the backwad low and is eachable only by GARAGE (line 5). Fo this eason, GARAGE diects and ex events as speciied in the eactoed set o lows (line 4). The eactoed GARAGE component needs only to check the temination o its main activity. In act, its check eaction (line 9) popagates the

330 G. Feai et al. 1 esticted ex; 2 component gaage { 3 local: ok; 4 lows: [(ok->gaage),(ex->cmp),(->cmp),(->dispatchepa )]; 5 knows: cmp; 6 eaction lambda (@s) { 7 split { do {emit <ok@s >;} o {emit <ex@s >;} } 8 { 9 addreaction (eaction check (ok@s) { 10 split { 11 emit <@s >; 12 } { 13 addreaction (eaction check (@s) { 14 emit <@s >; 15 }); 16 } 17 }); 18 } 19 } 20 potected component cmp { 21 lows: [(->ceditcad)]; 22 eaction lambda (ex@s) { 23 emit <@s >; 24 } 25 eaction check (@s) { 26 /* Coding o Compensation. 27 Deined by host language API. */ 28 nop; 29 emit <@s >; 30 } 31 } Code 1.8: Delegating compensation in SCL owad low and activates a listene o the ollback notiications possibly sent by subsequent tansactional components. Notice that the eaction implicitly delegates the execution o the compensation to CMP. Once a ollback is captued by GARAGE it is automatically owaded to CMP accoding to the lows deined in line 4. Hence, CMP is inomed i something goes wong eithe duing the execution o the main activity (ex events) o, ate its successul execution, when events is be deliveed by othe components. The component CMP waits the notiication o an exception (line 7) o a ollback equest coming om subsequent components. In the ome case, CMP simply activates the backwad low while, in the latte case, CMP executes the compensation that, upon temination, stats the backwad low (lines 26-29).

Reactoing Long Running Tansactions: A Case Study 331 n n n (a) (b) Fig. 6. Paallel composition and its eactoing 5.2 Reactoing Paallel Composition The mapping o the paallel composition o tansactions intoduces two additional components, a dispatche and a collecto, espectively acting as the enty and exit point o the paallel composition. To illustate the eactoing o paallel SCL tansactions the scenaio o 4 is extended by adding a new activity (DELAY) that inoms the Inomation System o the dive company about a possible delay. This activity can be peomed ate GARAGE has been contacted. Namely, the esulting business pocess contains thee concuent activities: the DELAY, the TRACK and the sub-tansaction that encloses RENTALCAR. Figue 6(a) depicts the lows and components equied to implement this paallel composition. Two distinct dispatches (D1 and D2) ae involved in the coodination. Dispatche D2 is esponsible to owad the eceived equests to components DELAY and TRACK and esults extenally the enty point o thei paallel composition. As esult, the dispatche D1 is connected to the enty point o the sub-tansaction RENTALCAR and to D2, acting as enty point o the whole paallel block. Simila consideations can be made o the exit points C1 andc2. The notiication o events to dispatches D1 and D2 ae not elevant to the semantic o the implementing netwok (moe pecisely these ae hidden notiication, since the dispatches ae not visible outside the netwok). The geneation o two dieent dispatches can povide a mechanism to optimize the communications among components. Fo example, i D2, DELAY, andtowtrack eside on the same host, the geneated dispatche pemits to educe the inte-host communications o the owad and backwad low, since it eceives only one inte-host signal and geneates two inta-host signals o DELAY and TOWTRACK. I DELAY, TOWTRACK, andrentalcar ae emotely executed, the two dispatches can be used applying ou next eactoing ule. Such ule can be applied in two diections, namely (i) it can mege two paallel dispatches into one (simpliying the SCL code) o (ii) it can split a dispatche into two paallel ones (eining inte-hosts communication). In the ollowing we summaize the eactoing o paallel dispatches.

332 G. Feai et al. Notewothy, the same stategy can povide a simila eactoing mechanism o the collectos. Theeactoingmegesthedispatche D2 with D1 as ollows: Migates any low tageted to the dispatche D2 to the dispatche D1. Fo example, the lows o TOWTRACK becomes lows: [(ok->towtack), (ex->towtack), (->RentalCa,Delay,d1), (->c2)] Add all lows o the dispatche D2 to the dispatche D1 (Code 1.9, line 2) Removes the component D2 Extends the synchonization o D1 in ode to wait the eception o thee ollback events (Code 1.9, line 10). 1 component D1 { 2 lows: [->Delay,TowTuck,dispatcheTans ], 3 [->gaage],[n->c1,c2]; 4 eaction lambda (@s) { 5 split { 6 emit (@s); 7 } { 8 emit (n@s); 9 } { 10 addreaction (eaction check (@s) { 11 addreaction (eaction check (@s) { 12 addreaction (eaction check (@s) { 13 emit (@s); 14 }); 15 }); 16 }); 17 } 18 } 19 } 6 Concluding Remaks Code 1.9: Resulting dispatche o the eactoing Sevice manageability is a key issue that must be solved to widely adopt SOC. This paadigm can simpliy sotwae adaptation when changes in the business elations occu. Howeve, the size o systems obtained by aggegating sevices can impose high costs possibly not aodable by small-medium entepises. O couse, this may pevent SOA (sevice oiented achitectue) to be lagely adopted and limit its success. To educe costs and the eots o adopting SOA solutions, developes and designes should sepaately manage dieent aspects a system. This goal can be achieved by the adoption o the Model Diven Development. Famewok and tools should povide

Reactoing Long Running Tansactions: A Case Study 333 speciic omalisms and languages suitable to manage a subset o the whole aspects o an application. We ocused on the issues elated to the management o tansactional aspects o SOA systems. In the last yeas seveal toolkits have been developed to handle these speciic issues (e.g. Eclipse/BPEL [2,12]). Howeve, these poposals lack solid oundational gounds, making it diicult to povide easoning techniques and to pove coectness o applications. In this pape we pesented some o the main beneits povided by the stict inteplay between theoetical esults and pogamming pactice. A key eatue o ou poposal is that any language involved by the development pocess has a omal desciption, allowing us to clealy deine the semantics o systems and to povide sound tools. Fo example, ou tool is equipped with eactoing ules that (i) suppot the designe in the einement pocess (ii) do not aect the semantics o the system. We plan to adopt the same methodology to povide uthe extension to ou amewok. We want to investigate omal methods to manage dieent aspects o the system (e.g. quality o sevice). These models can dive the deinition o domain speciic languages that allow the develope to sepaately manage the coesponding domains. Reeences 1. Ciancia, V., Feai, G., Guanciale, R., Stollo, D.: Global coodination policies o sevices. ENTCS 260, 73 89 (2010) 2. Eclipse Modeling Famewok, http://www.eclipse.og/modeling/em/ 3. Feai, G.L., Guanciale, R., Stollo, D., Tuosto, E.: Coodination via types in an eventbased amewok. In: Deick, J., Vain, J. (eds.) FORTE 2007. LNCS, vol. 4574, pp. 66 80. Spinge, Heidelbeg (2007) 4. Feai, G.L., Guanciale, R., Stollo, D., Tuosto, E.: Reactoing long uning tansactions. In: WSFM (2008) 5. Feai, G.L., Guanciale, R., Stollo, D.: Jscl: A middlewae o sevice coodination. In: Najm, et al. [6], pp. 46 60 6. Najm, E., Padat-Peye, J.-F., Donzeau-Gouge, V. (eds.): FORTE 2006. LNCS, vol. 4229. Spinge, Heidelbeg (2006) 7. OpenAchitectueWae MDA/MDD geneato amewok, http://www.openachitectuewae.og/ 8. Business Pocess Modeling Notation (2002), http://www.bpmn.og 9. SENSORIA poject, http://sensoia.ast.de/ 10. White, S.: Intoduction to BPMN (May 2004), http://www.bpmn.og/documents/intoduction%20to%20bpmn.pd 11. Wising, M., Clak, A., Gilmoe, S., Hölzl, M.M., Knapp, A., Koch, N., Schoede, A.: Semantic-based development o sevice-oiented systems. In: Najm, et al. [6], pp. 24 45 12. Wohed, P., van de Aalst, W.M., Dumas, M., te Hostede, A.H.: Patten Based Analysis o BPEL4WS. Technical epot, Depatment o Compute and Systems Sciences Stockholm Univesity/The Royal Institute o Technology, Sweden (Novembe 2003)

334 G. Feai et al. A Oveview obpmn The gaphical notation o BPMN pemits to descibe the wok-low o a distibuted system by a global point o view. The sotwae achitect can abstact om the distibution o the pocesses, the communication mechanisms and the technologies that will implement each pocess. We ocus on the tansactional pat o BPMN that in the ollowing we indicate as LRT. Speciically, LRT encloses only the subset o BPMN necessay to model LRT. The basic elements o LRT ae compensable activities, namely pais o activities and compensations that can be composed sequentially o in paallel. (a) Sequence (b) Paallel (c) Tansactional scope Fig. 7. Composition o compensable activities Figue 7 depicts the designs espectively o sequential (a) and paallel (b) composition o compensable activities.main activities and thei compensations ae epesented as boxes linked by dashed aows (o instance, Task1 has a compensation enty point to which its compensation Comp1 is attached). The sequential composition is peomed by linking togethe the main activities (c. Figue 7(a)), while the paallel composition makes use o ok and join opeatos. In Figue 7(b) it is epoted a paallel composition o two tansactional activities. The two cicles epesent the stat event and the end event o the whole pocess, while the diamond with the plus opeation epesents the join o the two paallel activities. The ok opeation is implicit in the multiple connections on the stat event. Finally, compensable activities, and thei compositions, can be enclosed inside tansactional boundaies as shown in Figue 7(c). All the elements pesented at this laye ae inheited om the coe meta-models o BPMN and UML4SOA [11] and have the usual meaning o lowchat designs. Pocesses ae built by composing activities as in Figue 7. BPMN does not speciy the intenal behaviou o activities and the inteactions among components.