1 - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 - - PDF document

P


slide-1
SLIDE 1

1

  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
✟✡✠☞☛✍✌✏✎☞☛✑✌✓✒✔✌✖✕✗☛✔✘✚✙✛✒✗✌☞✜✣✢✤✌✦✥☞✠✤✧✩★ ✕✪✘✫✧✑☛✭✬✣★✯✮✰✮✲✱ ☛✳✒☞✴✵✥✪✠☞☛✔✶✍✷✸☛✗✕✍✢✸☛✳✒✤✴ ✹✔✺✗✻✍✼✦✽✔✾✤✿❀✹✸❁✤❂✪❃ ❄ ❅❇❆✗❈✤❉✖❊✤❆✑❋✗●■❍ ❏❑❆✔❈✗▲✗▲✗▼✗◆✪❖ P ◗■❘✤❙❯❚✚❱✗❲❳❱✪❨☞❩✔❬✍❭✸❩✍❲✗❚✸❩✳❘✤❪✣❘✔❫✗❩■❴✦❱✔❵☞❛❀❘✤❲☞❨❝❜■❩❡❞✑❴❢❘✤❭✤❫✔❩✍❣✐❤ ❥ ❦❇❧✗♠✤♥✵♦✓♣✔qsr✉t ✈✣r✗✇②① ✈✸♥✖③ ④ ⑤■⑥✤⑦⑨⑧ ⑩✵❶✸⑤❷⑧ ⑩✪❸✑⑥✤❹✗❺❻⑧ ❹✪❹✗❺✗❶❢⑦✛⑥✗❼☞❽✸❺✍❸❻❺✗❹☞❾✍⑧❀❼✚⑥☞❹✗❿✓❺✔❹✔❶➀⑩■➁✤⑦➂⑧ ❶✫⑤✐❿➄➃✑➅ ❶✤⑧✯➆❷➅ ❺❝⑩✸❺■❼✏❾☞❺■❼✏⑩ ⑧ ❹✤❾☞⑥s➅ ❾☞❺✍❸➇⑧ ❹❝⑥✤❹✗❺✪⑩✤➃✤➈☞⑤✳⑩✸❺✔➉■➃✸❺✍❹✔➈☞❺❡➊

client ATM server BANK

input_pin(PIN); select_withdraw; select_checking; withdraw_request(amount); ...

authorize_withdraw;

slide-2
SLIDE 2

2

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ☎✝✆
  • ✞✝✟
  • ☛✌☞
  • ✍✏✎
  • ✓✝✔
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • ✣✥✤
  • ✱✥✲
  • ✻✽✼✿✾❁❀❃❂❄✾❆❅❄❇❉❈❋❊❉❀❍●
❂❃❇✿✾❆✼■❇❉❏ ❑❁▲❁▼❆◆✿❖◗P❉❘❙❑❃❚❱❯✿❲❨❳✽▼◗P❩❖❉❬❄❖❭❘❫❪ ❖❵❴❛❪ ▼❝❜❭❪❋❘ ❞❆❡❢P■❣ ❤❁✐❁❥❆❦✿❧◗♠❉♥❙❤❃♦q♣sr t✉❤❃❤❵✈✇❧❝①❵②③♥ ④❵⑤❢♠ ⑥❁⑦❁⑧❆⑨✿⑩◗❶❉❷❙⑥❃❸❺❹❼❻❨❽✽⑧❢❶❾⑩❉❿❄⑩✉❷➁➀ ⑩❵➂❼➀ ⑧➃⑨➄⑥❁⑥◗➅➇➆ ➈❁➉❁➊❆➋✿➌◗➍❉➎❙➈❃➏➑➐➓➒ ➔✉➈❃➈❵→✇➌➃➋➄➈❉➈❁➣ ↔ ➋✿➌❁➏❃↕❄➌❆➙❄➍❉➎❋➈❉➏❍➛ ➊❢➏❁➜❛➒
slide-3
SLIDE 3

3

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✄✆☎✞✝✠✟☛✡
☞✌✡ ☎✎✍

✏✒✑✔✓✌✕✖✓✌✗✔✘✎✙✠✙✛✚✜✘✣✢✤✓✠✘✦✥✆✓✧✗✎★✪✩✠✫✣✙✬✕✖✓✠✘✣✭ ✩✛✗✔✚✮✓✌✕✎✙✰✯✌✑✠✗✔✱✳✲ ✙✠✱✰✘✴✩✵✏✒✙✠✘✣✢✒✙✧✕✶✓✛✗✔✱✷✓✠✫✒✫✣✙✤✓✌✕✶✓✒✚✸✩✌✗✴✙ ✹✴✺✌✻✔✼✵✽ ✾✛✿✴✺✠✿✵❀❁✿✠✻✤✽ ✼✮✺✠❂✦❃❄✺✛❅✔❆ ❇ ❈✧❉ ❉✣❊✛❋✦●✞❊✒❍✣■✧❏
  • ✔❑✧▲✒❏
▼ ◆✧▼ ▲✠❏ ❖✜❍✔❋✎❈✌●✔P✎❈✛◗✣❍✣❏ ❊✌●❘❏ P☛❏
  • ✔❍✎◆✧❋✔❋✞❙✤❚✤❍✞◆✠❯✳▲✴❈❱❉
❉✒❏ ❍✞P❁❲❳❊✛❋✔❨❩❏ P❁❙✠●✴❯✧❊✠●✴◆
  • ❬✬❭✠❪✤❫✵❴
❫✎❵✔❛✌❪✣❜✣❝ ❞

❡✒❢✔❣✌❤✖❣✌✐✔❥✎❦✠❦✛❧✜❥✣♠✤❣✠❥✶❣✪❥✔❤♥❣✧✐✔❧✎❣✠♦✵❥✣♣ q✌✐✦r✆♣ts s✌s ❦✠❣✒✉✞❦✷❥✣♠✤❦✈❧✎✇✠❧✴❥✞❦✧①②♣ ✐✸❣❩♦✔q✌✐✔❧✵♣ ❧✴❥✴❦✧✐✔❥✸❧✴❥✎❣✠❥✎❦✈③④♣ ⑤ ❦✬⑤ ⑥✴❣❱s s ⑦ ⑧✔⑨✞⑩✠❶✛❷✔⑦ ⑨♥❸✷❹✔❺✌⑧✔❻✔⑨✔❷♥❼✌⑦ ⑧✔⑨✞❻✦❻✎❼✠⑨✣⑦ ❻✔❽✒⑦ ⑩✠❾✬❿➀❼✛❽✣⑨✎⑩✌❷✮⑨✵❷✖❼✌⑧✔❻✎❼✛❹✣⑨✣⑦ ❺✌⑧❁❹✔❺✛➁✸➂✌➃ ⑩✛⑨✞⑩✠❻ ➄ ⑨✔➅✠⑩❩⑨✔❷✎❼✛⑧✔❻✞❼✠❹✵⑨✣⑦ ❺✌⑧✜➂✛❷♥⑩✛❻✴⑩✌❷✴➆✞⑩✠❻✸❼❱➃ ➃✵❻✎❸✠❻✣⑨✎⑩✌➁②➂✒❷♥❺✠➂✵⑩✌❷✞⑨✵⑦ ⑩✛❻
  • ➇✛➈✴➉✛➊
➋✒➌✵➍ ➉✠➎➀➏

➐✒➑✎➒✒➓✎➔✌→✵➓✞➣✦→✔➒✌↔✣→✤↕✤➑✔➑✎➔✧↔✔➓✒➙ ➛✪➔✠➜✧➔✛→✵↕✵➓✤➝ ↔✔➞❘➓✵➑✖➟✌↔✔➣✎➟✛→✣➓✣➝ ➒✌↔✔➣✦➠✤➑✎➒✛➡➢➣✴➔✠➔✬➝ ↔✔➞❘➔✤➟✠→✒➤❘➒✒➓✣➤✒➔✧➑ ’ ➣ ➝ ↔✣→✔➒✛➡✮➐✬➙ ➔✌➓✎➔✈➑♥➔✌➣✔↕✌➙ ➓✞➣ ➥ ➟✧➙ ➙✵➓✔➑✖➟✧↔✴➣✴➟✠→✔➓✤➝ ➒✌↔✔➣✦➓✣➤✧➝ ↔✤➦✦➓✣➤✒➔✒➛☛➟✌➑♥➔✪➔✌➜✌➔✌→✵↕✵➓✣➝ ↔✔➞❘➣✞➔✬➑✔➝ ➟✬➙ ➙ ➛❱➧✣➔✠➨✞➔❱↔❘➝ ➠❁➓✔➤✠➔✤➛❘➟✛➑✞➔✈➑✞↕✠↔✤↔✤➝ ↔✴➞ →✴➒✌↔✣→✤↕✤➑✣➑♥➔✧↔✔➓✠➙ ➛
  • ➩➭➫✒➯✞➲✌➳➀➵
➸➺➵ ➻✞➼➾➽

➚✒➪✔➶✌➹✖➶✌➘✔➴✎➷✠➷✛➬✜➴✣➮✤➶✠➴✜➪✤➱✵✃✛➶✒➴✞➷✠➬✦➴✎❐✷❒❮➶✌➘✞➶✒➚✤➷✠✃❰➹✎➷✛➬✞❐✠➪✒➹✴Ï✣➷✠➬✒Ð✵➬✵➪✣Ï✒➮❘➶✠➬✜✃✛➶✒➴♥➶✧Ñ✤➶✠➬✞➷✰➹♥➷✌Ï✔❐✛➹✞✃✬➬✒Ð ➬✔➪✒➹✎Ò✒Ó Ò✞➷✈➮✒➶✛➹✎✃✬Ô✳➶✌➹✎➷❘➶✌➘✔✃✰➬✞❐✠Õ✣➴✴Ô✳➶✌➹✎➷✷Õ✴➶✛ÓtÖ ➪✒➹✎➷✛➬✵× Ø Ù❄Ú✒Û✰Ü♥Û✛Ý✣Þ✌ß à✴Ý✜á✒â✜ã❩ä✣á✛å✮æ✧ß Û✠à✎Û✛ç✰à✔Ü♥ã✧è✔Ý✎ã✠ä✵à✣é á✛è✸ã✌Ü♥Û✷æ✣Û✬Ü✴å✶ã✛è✴Û❱è✴à✶ã✧è✔çëê➭é➺ß ß✠è✴Û✛ì✞Û✧Ü❁í✒Û❰ß á✒Ý✴à

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • î
  • ï
  • ð
  • ñ
  • ò
  • ó
  • ô
  • õ
  • ó
  • ó
  • õ
  • ö
  • ó
  • ô
  • õ
  • ÷
  • ø
  • ÷
  • ù
  • ú
  • ó
  • õ
  • ó
  • ù
  • ö
  • û
  • üþý
  • ÿ
  • ÿ
  • ☎✝✆
  • ✡☞☛
  • ✡✍☛
slide-4
SLIDE 4

4

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✁☎✄✝✆✟✞✠✆✂✡☛✆✌☞✌✍✎✞✏✍✒✑✠✓✔☞☎✕✗✖✘✁✌✙✌✚✂✑✏✓✔✆✜✛✢✛
✣✤☞✟✥✦✍✦✆✝✧☛✖✘✁✌★✝✩✗✪✦✫✬✚✭✁✬☞✂✖ ☞✬✞✮✍☛✁✟✫✮✣✯✓✰✍✦✆✭✁✬☞ ✱✮✲✂✳✟✱✴✱✮✲✒✵✎✶✒✳✦✱✷✳✯✸✘✹✺✱✻✲✼✵✤✶✒✳✟✱✠✳✂✽☛✳✌✾✌✵✿✸❀✾✤❁✌✵✂❂✟✱❃✸✘✹❄✳

❅✻❆✒❇✏❇ ✵ ❅ ✱ ” ✾✻✱✏✳✟✱✮✵ ❈❊❉✢❋❀●✒❋■❍✬❏☎❑✌▲✭▼✬◆✂❉❀◆✬❖✮●☛▼✌❖✰◆✻❖✏❏✌❖✻●✒❋◗P
  • ❘❚❙✝❯✌❱☎❲❨❳✴❯✼❩✢❩✒❲❨❬✟❱✏❭✦❪✼❫✬❲❨❱❵❴❜❛✬❝☛❬✬❳✻❱✟❫❞❯✒❲❨❬✟❱✷❳❄❯✂❫✷❭✤❡✦❢✒❩
❡✂❲❣❩✢❩❀❭☛❤❥✐
  • ❦✂❧✝♠♦♥✭♣✼q✭rts✼✉❀♥✜✈

✇②①✷①✠③✠④⑥⑤✰⑦❵⑧✻⑨✏⑦⑩⑨t❶✠③❵①✷⑦❞❷✻④❸⑤✟❹❺❶❻⑨✻❼✮❶✠⑤✂❽ ①❾⑦❵⑧✌⑤✰⑦❵❹✠❿❨➀✟➁✏➂➃⑧✟⑤t➄✭⑤✮①❵⑦✏❿❀❼✠⑨✏⑦✏❿❨❷✷❼t❶✬❿ ⑦✗➅ ➆✏➇✟➈✮➉✟➊ ➋✤➌✟➍✴➎❻➍✌➏⑩➈✠➐✠➍✻➋❄➑✮➎❻➈✮➏➓➒❵➇✌➍☎➊✘➔ ➆✷➒❺➈✠➑♦→✮➔❀➒✏➔ ➍✻➆t➔ ➣t➇✂➔ ➆↔➒❞➎✠➔❨↕♦↕☛➊ ➙✮➣✌➛

➜ ➣↔➙✮➒➝➒➝➙✬→✠➇✟➍✬➋❃→➝➙✌➎❺➎❻➍✻➣✮➒➞➙☛➊✬➔❀➣✔➒❵➇✟➍✰➋✭➍✮➆✷➒✏➔ ➣✠➙✻➒✏➔ ➈✏➣t→✻➔ ➒✗➟♦➆✮➇✌➈✻➉✟➊ ➋✤➌✌➍t➋✭➍✂➊ ➍✮➒❵➍✻➋✂➛
  • ➠☛➡☎➢
➤✺➥✟➦✟➡✏➧☛➨❄➩❃➤✟➫✂➩✂➭✷➧☛➯➲➭✷➧✦➤✟➳✟➥✦➨✌➤✂➢➸➵❥➢■➺➸➢❨➡❵➻✿➵✝➧✭➡✏➼⑩➧☛➧☛➨❄➩✭➳✭➳✼➺➸➢❨➽✻➩✦➡✟➢✘➥✦➨✺➩✭➨✟➯ ➾✮➚✒➪❜➶✝➹✟➾✠➹✝➘☛➹✌➴✬➪✤➾✏➷✎➬✰➹✝➮✘➱✟➾✷➹✼➮✘➱❃✃✬➷✭➱✬➴✂➮❨➴✮➾✻➪☛➱✟✃✏❐✜❒

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • Ï
  • Ð
  • Ñ
  • Ò
  • Ó
  • Ô
  • Õ
  • Ö
  • Ó
  • ×
  • Õ
  • Ø
  • Ù
  • Ú
  • Ú
  • Û
  • Ü
  • Ý
  • Þ
  • ß②à❵á☛â✷ã②ä✠å
æ ç✠è❵ãêéìë❣í❵î✗â⑥é❊â✠ï➝ãðï➞ñ➞ï✠æòå ï✷ó✬å â✏ô ß②à❞á☛â✏ã➃ä✏å❀æ ç✷è✷ãõéìë✢í✠î✗â❸é➞â❵ï❞ã❥ï❻ñ❊ï✮æ✘å ï✏ó✬å â✠ô ö✟÷❵ø✂ù✷úðû✏ü ý þ✷ÿ✠ú✁✄✂✆☎✞✝✗ù✟❊ù✡✠❞ú☛✠✌☞✍✠✏ý✘ü ✠✏✎✬ü ù✒✑ ✓✕✔✗✖✙✘✚✘✏✛✢✜✞✣✥✤ ✦✞✧✙★✪✩✄✫✬✤ ✩✭✩✌✮✰✯✙✱✳✲✴★✵✤ ✶✡✛✍✯✙★✍✷ ✓✕✔✸✖✙✘✚✘✹✛✢✜✞✣ ✤ ✦✡✧✞★✁✩✄✫✬✤ ✩✍✩✰✮✰✯✺★✵✤ ✶✡✛✍✯✙★✍✷ ✖✻✔✽✼✾✯✙★☛✜✏✣✥✤ ✦✙✧✙★✪✩✄✫❀✿✍✘✴✩✰✯✡✲✌★✰✷ ✖✻✔✸✖✞✘✚✘✏✛❁✜✏✣✥✤ ✦✞✧✙★✪✩❁✫❂✤ ✩✭✩✵✮✰✯❃★✚✤ ✶✚✛✍✯✞★✭✷ ❄✻❅✙❆❈❇✚❉✙❊✪❋
  • ✰❍✰■✌❏✁❑✙▲◆▼✞❖✴P❘◗
■✟◗ ■✭■✵❍✰▼✙❙✺❚✙❯
  • ✰❑✡❖✭❖✁▼✞●✌❏❱❖✁▼✡■✵❍✏❲
❏ ❳✍❨✡❳✌❩❭❬✞❪❴❫ ❵✍❛✚❫ ❳✰❜✴❛✡❫ ❝✚❞✰❬✙❛
slide-5
SLIDE 5

5

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✁☎✄✝✆✟✞✡✠☞☛✌✠
✍✝✎✑✏✒✆✒✓✕✔✖☛ ✗✕✘✙✍✚✏✛✗✜✘✢✠ ✍✚✁✣✆✕✍☎✠✌✤✥✓✧✦★✏✛✗✟✄✩✗✧✘✩✎✕✘✥✍✩✗✟✪✬✫✭✆✟✠☞☛ ✘✮✄✥✠ ✯✢✏✛✍✰✆✕✫✥✍✣✗✛✄✱✍✚✏✛✗ ✲✕✳✴✲✛✵✥✶✭✷☎✸✺✹☎✻✼✹✥✽✾✷✭✿✛✲✜✷✚❀✝❁✕✻☎❂✣❁✢✵✚✷☎✸✺✹☎✻❃✸ ❂✧✵✥✹☎❄❆❅✡❇ ✲✒✷✣✲✒❈✑❁✕✻✒❈❊❉✛✲✒✽✥✹✒❀✩✲✜✷✚✿✟✲✑❀✩✲✕❂✥✶❋❇ ✷✧✸ ❂
  • ■❍✥❏
❑✩❑✣▲✒▼✼❑✩◆✼❖✒▲✢❍✚P❘◗✒▼✒▲✕▼☎❑✱❙✭❑✣◆✒❍✝◗✥❚✛▲❱❯ ❲❨❳ ❩✝❬✭❭✚❪❫❩❵❴✢❪✩❛❝❜✭❞✢❳✌❡✌❳ ❩❣❢ ❲❨❳ ❩❫❬✱❴✢❪❫❛❤❜✭❞✒❳✐❡✺❳ ❩❝❢ ❥❧❦✚♠✴♥❝♦✭♣✝qr♦✚s✝t✣✉ ✈✥♣❘✇①q②t❝♦✚♥❤t ③❧④✰⑤✩⑥✣⑦✰⑧✚⑨✝⑧✥⑩❣❶✰⑥✥❷②⑧✥⑩❝❸✩❹✣❺ ⑥✭❻❆❺ ❻■❸❽❼✥❺✐❾ ⑧ ❿✕➀✣➁✴➂❝➃✚➄②➅r➃✚➆②➇✩➈ ➉✥➄✱➊✙➋✕➉✭➌■➌❽➈ ➇ ❿✕➀✣➁✴➂❝➃✚➄✝➅✝➃✣➆❫➇✩➈ ➉✥➄➎➍①➅❫➇❝➃✚➂❤➇ ➏✢➐☎➑✖➒ ➓✣➔➎→✝➣✕➒✐↔ ➓ ➏✢➐✣↕✴➙❝➣✚➛✝➓✝➣✣➜❫➝✩➒ ➞✥➛✱➟✾➜②➞✚➠✂➠✰➒ ➝ ➡➤➢②➥r➦☎➧➩➨✕➫ ➧❝➦✚➨✩➭✥➯✰➲✣➳✣➵✂➵❫➸✣➦

➥②➢✩➺❫➺✝➦✚➥②➥ ” ➻✟➼☎➽✖➾ ➚✣➪➎➶✝➹✕➾✐➘ ➚ ➴✂➷✚➬✝➬✝➮❫➱✣➷✥✃ ❐✛❒✣❮✩❰✚Ï☎❮✣Ð➎Ñ②❰✚Ï❆ÑrÒ❤Ó✣Ô✝Õ✝Ó✣❮❫Ñ✩Ö ×✥Ô❆Ø ×✩Ù Ú➤Û✕Ü✭Ý②Þ☎ß à✰á Ý❽â✝ã✚à✖ä✚Ü✥à❽á â➎à✝å✚Üçæ✥è✣à❝è☎é✣è②Ý②Ü✥ê ë✛ì✣í✒î☎ïrð✣ñrî✕ò➩ó✩ò❝ð✚ô❵õ❋ö ÷✭ø★ó②ù✥öûú ü✣ò❣î ý✟þ✩ÿ✁✄✂✆☎✄✝✟✞ ✠☛✡✥þ ☞✍✌✏✎ ✑ ✂ ✑ ✄✂ ✌ ✂✓✒✕✔✆✞ ✑✖✑ ✠✘✗✆✙ ✑ ✙✛✚✄✙✕✒✕✂ ✜✣✢☛✤✦✥★✧✄✩✫✪✫✧☛✬✮✭✏✯ ✰✛✩✖✪✮✱✏✬✮✬✕✲✄✲✓✳✆✪✏✢

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

Client + BookTrip(): boolean BookingSystem

+ CheckFlights() + CheckRooms() + BookFlight() + BookRoom()

  • ❂❄❃
slide-6
SLIDE 6

6

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✁
  • public boolean BookTrip(){

UserTransaction transaction = context.getUserTransaction(); try{ transaction.begin(); if(bookingSystem.CheckFlight()) bookingSystem.BookFlight(); if(bookingSystem.CheckRoom()) bookingSystem.BookRoom(); transaction.end(); } catch(Exception ex){ try{ transaction.rollback(); }catch(SystemException s){ throw new Exception(‘Rollback failed’); } return true; }

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

✞✠✟☛✡✌☞✎✍✑✏✓✒✔☞✖✕✘✗✓✏✚✙✛✡✜✙✛✟✓✢✛☞✖✒✤✣✥✟✧✦★✙✛✟✓✏✩✍✫✪✓✏✓✒✭✬✧✟✓✍✮✬✧✯✓✏✰☞✱✣✥✟✓✍✲✣✧✳✔✏✑✙✛✟☛✗✰✴✧✡✵✬✓✏✑✙✶✡✵✬✧✏✤✬ ✷✹✸☛✺✼✻✵✽✤✾✶✿✑❀✠❁✧✸❂✻✛✸✰✾☛❃✚❄✥❃✔✿✮✾✠✺❆❅ ❇ ❈❊❉✘❋❍●✠■✭❏✛❑✓❋✧▲✑▲✛▼✹◆✓❖✶❏✧P✲◗✑❉✵❏✓▲✓❋✶◗✰■❙❘✥◆✔▲✮❘✥❑✔◗✧▼✱❏✧◆✓▲✲❘✠■✤❋☛◗✔❉✘❚✑▲❂❯✌▼ ▲✔◗✓■✔▼❲❱✵❚✔◗✮❋✛❯ ❳✥❨✼❩✛❬✓❭✜❪✱❬✰❫✑❩✘❴ ❫✔❵✛❛❝❜✚❞✛❜✔❡✮❵✠❨❢❜✥❣ ❤ ✐✥❥✭❦✛❧✔♠✧♥✑♥✠♦✹♣✔q✶rts✫✉❲♦✎q✠✈✫✇❂❥✩♠✧♥✔♠✵❥✤①✩r✧✇✰♦✹❦✧♣☛②③♦✱✇✑✈⑤④★⑥✵✉ ✇✰♦⑧⑦✘✉✎♠⑨✉ r✓q✥♥⑩♥✓♠✵❥✭①✛♦✹❧✔♠✛❶❸❷✧❹ ❺❼❻✎❽✓❽✓❾✵❿✤❾✛➀✰➁➃➂✵❻✖❿✰➄❲❻✱➀✧❾✧➅❍❻✎➅❆➂✧➀☛❾✥➆✘➂✛➇★➈✘➄✎❾✶➉✧❽✲➂t❺❼❻✎➅✑➁✰❿✔❻✖➊✘➋✑➁✑❾✛❺➌➁✓❿➍➂✧➀✓➅✑➂✧➎✔➁✧❻✎➉✛➀✛➏ ➐ ➑➓➒→➔↔➣✎↕❍↕✧➙✰➛✧➒➝➜✚➞✛➜✮➟✑↕✠➠➡↕✛➢✓➜✔➤✛➥✩↕✧➜✲➦➧➤✥➥✭➙✠➨→➔➩➣❲➔✱➟✭➞➝➫✰➭❝➔✎➟✚➜⑩➜✰➒✠➙✠➥✤↕❍➫✰➭❂➟✑➒✫↕ ➟✔➥➍➙✥➢✔➜✑➙✥➛✔➟✧➔✱➫✧➢❍➯✥➥✤➫✥➛✓↕✧➜✑➜✠➔✱➢✓➲➵➳✧➟✑➒✫↕✶➙✓➟✮➫✛➠❂➔✹➛✠➔✎➟✤➞❍➫✥➭✲➟✑➒✵↕✶↕✛➢✰➟✥➔✖➥✤↕✶➫✛➯✧↕✵➥✭➙✓➟✥➔✎➫✥➢ ➢✰↕✛↕✛➦✵➜✲➟✩➫❝➨✫↕➝↕✛➢✔➜✰➤✛➥✤↕✛➦❝➙✓➜❂➸➺↕➧➣➻➣⑧➼ ➽ ➾❊➒✫➙✓➟☛➔✱➜✲➦✘➫✧➢✧↕❍➟✮➒➧➥✭➫✛➤✔➲✠➒❝➟✮➒✵↕ ➚✚➪➹➶➧➘✠➴✥➷✫➬✠➮✮➱❐✃✰➶✛❒⑩❒✲❮✱➚❰➴✧Ï✩➶✰➚✑➶✰✃✰➶✫ÐÒÑ
slide-7
SLIDE 7

7

12/1/02

  • Transaction Manager

Resource Manager

Prepare Prepared Commit Done

Transaction Manager

Resource Manager

Prepare No Abort Done

Successful transaction Failed transaction

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

The above entities are involved in the 2PC transaction model (X/Open). The transaction manager processes Start, Commit and Abort. It talks to resource managers and other transaction managers to run two-phase commit

Application program Resource Manager

Transaction Manager

slide-8
SLIDE 8

8

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

☎✝✆✟✞✡✠☞☛✍✌✏✎✒✑✔✓✒✞✍✕✖✕✡✗ ✘✙✠☞✚✛✞✏✘✜✞✍✓✢✞✤✣☞✗ ✎✥✗✧✦★✗ ✘✏✗ ✌✩✘✜✑☞✪✬✫✏✭✮✌✯✎✰✠✍✑☞✓☞✗ ✌✤✣✩✕✖✞✩✪✲✱✲✣ ✑✤✳✩✓✜✌✴✣✵✣ ✑✍✪ ✶✢✷✛✸★✹✰✺✢✸✍✻✏✶✏✼ ✽✍✹✿✾❀✸★✹✏✸✍❁✍❂★✷✲❃ ❄ ❅❇❆✒❈✥❉✰❊☞❋✛●✏❍✧■☞❍✧❉✰❊✩●✏❍ ❆✰❏✥❑▲❊✍●▼❊✲◆✩❊✏❖✒P◗❖✛❈✩❖✰●✛P★❘❙■✜❊✍❆❚❊▲■✢●❀❊✏❖❯●✢❱▲P◗●✢❋▼❊✍❆✏❖✛❊☞■✒●✏❍ ❲✏❆ ❳❩❨✏❬✰❨✩❭✍❪★❫✒❴ ❵ ❛✩❜✡❝✮❞❢❡▼❣☞❤✲✐❦❥✛❝✴❧❦♠♦♥✛❣✍♥✒❡✜♣▲qr❡✢s▲♣◗❡✛t✟✉✯❤✍s✍❝✏♥✏♣✥❥✒✉✍q✖q✡✐ ❡❚s✍❝✏♥✡❡✈t✟✉✡✇①✐ ♥✢❡✏✐✧❜✍❥✢❡ ②☞③✛④✍⑤✢⑥✩⑦✢⑦✒⑥✍⑦❯⑧✢⑨✩⑩✍⑧❀⑩✍③✛⑥✯⑩▲⑤✰⑤✒④✍❶✖②✲❷❹❸ ⑦✰⑨▲⑥▲❺✬❸✧❻❼❷ ⑥✍⑦✢⑦❚⑧✢⑨✩⑩✍❻✡⑩✯❽✍③▼⑩✍⑤✒⑧✰❸❦④✰❻◗④✰❽❚⑩✯⑦✒⑥★⑤✒④✏❻✩❺❿❾ ➀➂➁▲➃✈➃✜➄✲➅❦➆✰➆ ➇➈➇➉➇➋➊ ➌✏➍✤➎❹➊✧➏✰➐✖➑✍➊ ➍☞➒✴➑✢➆✰➌✢➃✒➓✈➆✰➒✤➍✩➌✩➏✒➓✏➎✧➄✩➃✏➎ ➔✏→✏➌✢➆✏➒✲➃✜➄☞➏✍➊ ➁☞➃✢➐✮➣ ↔ ↕ ➙❩➛☞➜➞➝✍➟✛➜✲➠✩➡▲➟✛➜➞➝★➛✍➡▲➢✜➜ ➤✏➥➈➦★➧▲➨✛➧◗➩✢➦★➧✮➫➯➭ ➲▲➳✩➵✴➭✩➸✰➲✰➲✍➨✛➺①➻✧➼✢➵✍➩✜➲✩➨✙➽➾➻ ➼✲➻ ➩✰➻ ➵✍➩✏➻ ➼✏➫ ➚▲➪✩➶➹➪▲➘✍➪✩➴✒➷▲➬➉➮✛➷✍➱✍✃✰➷✩➴✒➶✈➴❚➶✢❐✩➪✍➶❀➪✴❒✵❒✏❮✢➪▲➮✈➶✏❰❹Ï✩❰❦❮✰➪✏Ð✩➶✈➴✯ÑÒ➚①❰ ➴✢➶✒➮✰❰❹➘✲✃✒➶✜➷☞➚❼➚☞➪✩➶➹➪★➘✍➪✏➴✰➷✩➴✰➬ÔÓ❩❰Õ❒✵❒ Ö☞×✛Ø✍Ù❚Ú Û✒Ü◗Ý✜Ø◗Þ✰Ø✏Ù✙Ù✡Ú Ý✙Ø✩×✙×✛Ø✤ß✵ß✧à✩á▲Þ✩â❚Ý✢ã★Ü◗Ý✢×▼á✩ä✏Û✛á▲Þ✢Ý✏Ú✧Ø✰ä★å✯æ❯Ø✰Ý✜Ü✤ç★è➋ä✜é✔ê▲á✏Ý➹á✲à✍á✰Û✰Ü ë✒ì✩í✲î ï✔ð✒ñ▲ò➹ó✏ñ✯ô✰ð❯õ✢ö★ñ✮÷➯î ì▲ø✩ô➯î✏ë✒ì✏ì✍ò✛ï①ù ú✒ô✍õ✜ì✍ò✏û✏ï✤ñ✍ü✍ñ✍ú✍ï①ù ú✏÷✥ì✏ú✮õ✜ö★ñ◗õ✢ò▼ô✏ú✏ð✜ô☞ë✢õ✏ù❦ì✰ú▲ý þ➯ÿ ✂✁☎✄✝✆✟✞☎✠✡✠☞☛ ✌✎✍✏✁☎✑☎✒✓✄ ✔✖✕✘✗✚✙✚✛✜✙✣✢✟✤✥✤✖✦✧✢★✛✪✩✖✫✭✬★✫✮✦✧✢★✯✧✩✪✰✣✛✜✙✱✰✲✦★✳✖✯★✴✵✩✶✳☞✩✓✗✏✙ ✷✲✸✖✸★✹✜✺✼✻ ✽✲✾★✿✜✸★✹✡✿✓❀★✾✱✿❁✿✓❀✚❂✖❃✣✾✚✹✜❂❅❄☎✹✜❂☎❄✧✾✚✹✜❂☎✺❇❆✲✿✲❀☎❂☎✽✣✿✓❀✏❂❈✷✧✸✧✸★✹✜✺✼✻✮✽✓✾★✿✶✸✱✹✂✾✱❉★❊✶❉❋✾❍●✥● ■★❏✧❑▼▲✱◆P❖✶❏❅◗✓❏★❘❋❘P❙✮❖❁❖✶❚✏▲❅❖✓❯❲❱✖■✖◆✶❱✚◗✶❖✖❙❳❏✖■☎❨✱❩✱❬❭❱❍❪✥❪✖❫✧❱☎❯✪❖✖❙❳◗★❙✮❫✧❱★■✖❖✪◆☞◗✶❱✱■✖■★❏✖❖❁❫☎❯✜▲✚❫✓❱✚❯✜▲ ❏★❯✡❖✶❚✏▲✚❯✜▲❴❙ ◆❋❱✣◆✜❵✱◆✧❖✜▲✏❘❛◗✧❏★❘✡❫★❏✧■★▲✱■✱❖❁❬✶❱▼❙❜❪ ❝✱❯✜▲❍❞✖❖✶❚✏▲❡◗✧❏✖❏★❯✜❑✼❙ ■✲❱✱❖✓❏✖❯✂❱✱◆☎❢✶◆❁❱✟❪✥❪ ❑✚❱✱❖❣❱✚❤★❱✱◆✲▲✱◆P❖✶❏✐❯✶❏❥❪✥❪☎❤★❱★◗☎❢❭❖✓❚✚▲❅❖✓❯❲❱★■✲◆✓❱☎◗✓❖✧❙❳❏✖■✚❨

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

http://www.vermicelli.pasta.cs.uit.no/ipv6/students/andrer/doc/html/node18.html

slide-9
SLIDE 9

9

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

Update X Commit Update Y System Fails …. System Recovers The system lost the update to Y when it can’t commit the transaction after recovery.

New York System

London System

Update X Write X Commit

Update Y Write Y System fails … System Recovers

New York System London System

Since the system saved the update to disk before failing, it can commit the transaction after it recovers.

  • a. Without two phased commit, the

failure caused the update to Y to be lost.

  • b. With two-phase commit, the London system

durably saved the update to Y, so it can commit after it recovers.

✟✡✠☞☛✌☛✌✍✏✎✒✑✔✓✖✕✗✕✏✘✙✑✚✑✌✛✌✜✢✍✒✣✤✕✥✘✙✑✚✕✏✦✧✓✌✛★✎✥✓✪✩✥✕✒✫✬✍✒✛✙✭✒✮✯✑✰✛✖✑✌✑✪✜✱✕✥✍✚✠☞☛✌✜✲✓✌✕✥✑✚✕✏✘✲✑ ✳✵✴✖✳✏✶✏✷✲✸✹✳✻✺ ✼✱✽✪✾✒✶✥✿✢❀❁✷✖❂❄❃❅✾✌❆☞❇✗❈✌✼✒❉❋❊✲✾✒✼✌❉●✾★✼❍❂■✺ ✶✏✿✻✶✥✿✙✷✻❆✵✷✖✳✖❏✪❑ ✶▲✳✖▼

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

Transaction Manager

Resource Manager in New York Resource Manager in London

Transaction Manager

Resource Manager in New York Resource Manager in London

  • 1. prepare
  • 2. prepared
  • 1. prepare
  • 2. prepared
  • 3. commit
  • 3. commit
  • 4. ok
  • 4. ok

phase one phase two

slide-10
SLIDE 10

10

  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
slide-11
SLIDE 11

11

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✠✡✠
  • ✠✡☞✍✌
  • ✠✎✠
  • ✑✒✑
  • ✕✡✕
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • ✚✜✛
  • ✤✡✤
  • ✙✪✛
slide-12
SLIDE 12

12

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✆✂
  • ✠☛✠
  • ✠✍✠
  • ✎✏✎
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • ✒☛✒
✔✖✕✘✗✚✙✜✛✣✢✤✙✦✥✧✕✜★✪✩✦✛✫✢✣✬✭✗✯✮✰★✪✥✣✬✲✱✴✳✵✢✧✕✴✢✧✳✜✶✦✶✘✩✷✗✯✕✴✕✵✸✭✬✜✢✣✬✭✹ ✺ ✻✽✼✿✾✰❀✜❁❃❂❅❄✦❆✧❄❇❂✧✼✘❈✚✻✜❉✣❊✵✻✘❋✣✼✜●❅✾✦❉✫✻✦❉✘❍■❋✧✻✜❉✜❉✣✾✜✼❑❏▲✻✘❆✧❄▼✻◆❋✘❏❖●P❂❅❍ ✼✣❈✚✻✜❉✣❊✵✻✜❋✣✼✘●✪✾✦❉
❙✖❚✘❯✚❱✜❲✣❳✤❱✦❨✧❚✜❩✪❬✦❲✫❳✣❭✭❯✯❪✰❩✪❨✣❭❫❲✘❭✰❭✰❴■❲✘❬✜❚▼❩❛❵✴❜❞❝❅❭▲❵❡❭✰❲✘❚✧❢ ❘ ❣▲❤✯✐✦❥✦❦♠❧♦♥▼♣✣✐✷❤rq✽♣✭❦✪s✘♥✭❤✉t✷❤✯q✦s✘✈✭✇ q▲❤✣❦❅①✯②❫✐✘♣③❤④♥✰⑤✧✐✦❥✧♥✭❤⑥② ⑦ ①✣❤✚q✜s✣⑧✵q✜⑤✣①✘❦✪✐✦s✽♣✵q✰⑨✫❦⑩✇ ② ❶ ❷❃❸✵❹✚❺✿❻✿❼✿❽✵❾❃❿▲➀➂➁ ➃❞❽④➄✣➀♠➅✭➁✪➀ ❻✤➆✰❽④❸✿❻✵❾④❺✵➄✯❼➈➇✵❹✤❽✿➃✦❺✿➄✤❾✯❺✧❻✿➃✣❸✵❻❃❼
slide-13
SLIDE 13

13

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

Flat Transaction Begin Trans. Crash Flat Transaction Abort Begin Trans.

  • Commit

Begin Trans. Flat Transaction

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

Commit Begin Trans. Main Transaction Child Transaction Begin Trans. Commit Child Transaction Begin Trans. Commit Child Transaction Begin Trans. Commit

slide-14
SLIDE 14

14

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

✂☎✄✝✆✟✞✡✠☞☛✌✞✎✍✑✏✒✏✔✓✖✕✔✗✘✆✙✠☞✓✛✚✜✏✔✓✖✞✡✠✛☛✢✏☞✄✖✣✖✍✥✤✌✦★✧✪✩✫✄☞✬✭✄✝✆✮✏✯✞✰✍✱✆✙✏☞✄☞✲ ✳ ✴✰✵✛✶✸✷✝✹✺✶✛✻✽✼✾✼☎✿✽❀❁❀✙✹✛❂☎✹✑❀✟❃❁❄❅✿✢✵✢❃✖❆☞✹✛✴✝❇❈❂✝❇❉✴❁❄☎❀✟✵☞✶☎❃❊✵☞✴☎❄✖❇❈✿✛✶ ❋
  • ✰❍✛■✸❏✝❑▼▲❉◆✡❖✪P◗▲❈●✽▲❈❘☞P
❙✸❚✑❯✜❑✛❱❲❖✪P◗▲❈●✽▲❈❘☞P ❙❳❘✎❯❨❍☞■☎❩✖◆❬▲❭❘❊❘❊❑✔❪❫❘✮❚✒❘☎❯❨❍✛■✎❩✰❍✖●☎❘✖▲❴❚☞■☎❍✪P ❵✝❛✖❜✮❝✔❞✰❡❅❢ ❣ ❤✪✐✾✐ ❵✛❥❧❦✝♠✙❵☎♥✑♠ ❤✛♦✡♦ ❝✑♠♣❡❅❵✸❦ ❤ ❢✰❢ ❤ ❢ ❤✛q ❝✛r✱❦ ✐◗s ❞ s ❡❁❦ ❤ ♠ ❤✔♦ ❝✛❡✰❝✑♠t❵✛✉ ❤ ✈✙✇✛①✛②✖✇☞③✎④
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • Object Request Broker (ORB)

Object Transaction Service

Transaction context

Transactional client

1 2 3 3 4 5 6 7

Transactional

  • bject

recoverable

  • bject

resource Sub- Transaction resource

Transation server Recoverable server

slide-15
SLIDE 15

15

12/1/02

  • Client

Resource Server Resource register_resource() register_rescource() Current

Coordinator

12/1/02

  • Client

Resource Server Resource commit() commit() Current

Coordinator

commit() prepare() prepare()

slide-16
SLIDE 16

16

12/1/02

  • Current Interface
  • TransactionFactory Interface
  • Control Interface
  • Terminal Interface
  • Coordinator Interface
  • Recovery Coordinator Interface
  • Resource Interface
  • Synchronization Interface
  • Subtransaction Aware Resource Interface
  • TransactionalObject Interface

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • Resource

+ prepare() + rollback() + commit() + commit_one_phase() + forget() <<Interface>> TransactionFactory + create() <<Interface>> Current + begin() + commit() + rollback() + rollback_only() + get_control() + get_status() <<Interface>> Terminator + commit() + rollback() <<Interface>> Control + get_terminator() + get_coordinator() <<Interface>> Coordinator + register_resource() + get_status() <<Interface>>

slide-17
SLIDE 17

17

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • interface Current: CORBA:: Current

{ void begin () raises (SubstransactionsUnavailable); void commit (in boolean report_heuristics) raises (Notransaction, HeuristicMixed, HeuristicsHazard); void rollback() raises (NoTransaction); void rollback_only() raises (NoTransactoin); Status get_status(); string get_transaction_name(); void set_timeout (in unsigned long seconds); Control get_control(); Control suspend(); void resume (in Control which) raises (InvalidControl); };

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • interface Control

{ Terminator get_terminator() raises (Unavailable); Coordinator get_coordinator() raises (Unavailable); };

slide-18
SLIDE 18

18

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • interface Coordinator

{ Status get_status(); Status get_parent_status(); Status get_top_level_status(); boolean is_same_transaction (in Coordinator tc); boolean is_related_transaction (in Coordinator tc); boolean is_ancestor_transaction (in Coordinator tc); boolean is_descendant_transaction (in Coordinator tc); boolean is_top_level_transaction(); unsigned long hash_transaction(); unsigned long hash_top_level_tran(); RecoveryCoordinator register_resource (in Resource r) raises (Inactive); void register_synchronization (in Synchronization sync) raises (Inactive, SynchronizationUnavailable); };

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • interface Terminator

{ void commit (in boolean report_heuristics) raises (HeuristicMixed, HeuristicHazard); void rollback (); };

slide-19
SLIDE 19

19

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • interface Resource

{ Vote prepare() raises (HeuristicMixed, HeuristicHazard); void rollback() raises (HeuristicCommit, HeuristicMixed, HeuristicHazard); void commit() raises (NotPrepared, HeuristicRollback, HeuristicMixed, HeuristicHazard); void commit_one_phase() raises (HeuristicHazard); void forget(); }; 12/1/02

  • //IDL sample

interface Stock: CosTransactions::TransactionalObject { exception RejectOrder { string Reason; } exception DBNotAvailable {}; attribute long inStock; readonly attribute string StockName; void Order ( in long amount ) raises (RejectOrder); void Query ( out long amount ) raises (DBNotAvailable); }; interface Store: CosTransactions::TransactionalObject { Stock GetStock (in long stock_id) raises (NoPart); void DeleteStock (in Stock p); }

slide-20
SLIDE 20

20

12/1/02

  • int main (…)

{ Stock_var pStock; try { //bind to the Stock object pStock = Stock::_bind (Server, host); } catch (CORBA::SystemExeption& ex) { cout << “Error Binding!” << &ex << endl; Encina::Client::Exit(1); } //rest of client code … return 0 }

12/1/02

  • try {

CosTransactions::Current::begin(); Stock_var StockObj = pStore->GetStock(id); StockObj.Order(100); CosTransactions::Current::commit(); } catch (CORBA::TRANSACTION_ROLLBACK) { CosTransactions::Current::rollback(); cout << “TransactionRollback exception, transaction aborted” << endl; commit = FALSE; } catch (CORBA::UserException& ex) { CosTransactions::Current::rollback(); commit = FALSE; cout << “TransactionRollback by ” << ex << endl; } catch (…) { CoTransaction::Current::rollback(); cout << “Unknown exception, transaction abortd” << endl; commit = FALSE }

slide-21
SLIDE 21

21

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✓✕✓

  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • ✳✴✳
  • ✲✕✲
  • ✵✸✵✹✶

slide-22
SLIDE 22

22

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✄✂
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
slide-23
SLIDE 23

23

(c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f

  • ✂✁
  • ✆✝✆
  • ✏✒✑
  • (c) 2002 Hans-Arno Jacobsen (jacobsen@eecg.toronto.edu) MIE491f
  • ✂✁
  • ☛✓✑
  • ☎✔✑