90 likes | 328 Views
Exception Mechanisms. Anirban De Jeffrey Harry Yves Lepouchard Peixin Li Pinchao Lu. Why we should care about exceptions. Ariane 5 Maiden Flight Computer automation is everywhere: in your daily life in critical systems Exception handling Our project deals with: Java
E N D
Exception Mechanisms Anirban De Jeffrey Harry Yves Lepouchard Peixin Li Pinchao Lu
Why we should care about exceptions • Ariane 5 Maiden Flight • Computer automation is everywhere: • in your daily life • in critical systems • Exception handling • Our project deals with: Java = THE HOT programming language HOT CS655 Project Presentation
Java Exception Handling • Exceptions are objects • Multilevel Model • Termination Model STOP! Server END Try { Workers Finally Cleaners } Catch { Handlers } Check Receive CS655 Project Presentation
Exception Handling Enhancements RESCUE-RETRY CONSTRUCT /* Attempt to transmit a message 100 times and set “tx_successful” */ Public void transmit_message(String message) { if (tx_failures < 100) { attempt_transmission(message); tx_successful = true; } else tx_successful = false; /** rescue { tx_failures = tx_failures + 1; retry; } **/ CS655 Project Presentation
Exception Handling Enhancements • Rescue-Retry added using JJTree and JavaCC • JJTree is a bottom-up Parse Tree Builder • JavaCC uses the output of JJTree to generate the Lexer/Parser • Generates a top-down, recursive descent parser • Partial EBNF Notation for Rescue-Retry: void MethodBodyBlock( ) : { [ RequireClause( ) ] ( BlockStatement( ) )* [EnsureClause( ) ] [RescueClause( )] } void RescueClause( ) : { <RESCUE> [ (RescueCatch( ) “;”)+ ] ] <ASSRN_END> } void RescueCatch( ) : { ( "catch" "(" FormalParameter() ")" )? "{" ( BlockStatement() | RetryStatement() )* “}” } CS655 Project Presentation
Evaluation Things we sort of already knew... • Java is slow, more Java is slower. • Given a Java program, adding more Java is going to make it larger. We didn’t know how much slower/larger... CS655 Project Presentation
Evaluation How much slower is Jass? How much larger? CS655 Project Presentation
Conclusion It’s a hog, it’s slow, it’s big... Value inside (Safe, reusable error-free code.) BUT... CS655 Project Presentation
Java Exception Handling CS655 Project Presentation