Download Group 2: Exception Mechanisms

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
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

1 May 2000
CS655 Project Presentation
2
Java Exception Handling



Exceptions are objects
Multilevel Model
Termination Model
Server
Try {
Workers
Finally
Check
Cleaners }
Catch {
Handlers }
1 May 2000
Receive
CS655 Project Presentation
3
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;
} **/
1 May 2000
CS655 Project Presentation
4
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()
)* “}” }
1 May 2000
CS655 Project Presentation
5
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...
1 May 2000
CS655 Project Presentation
6
Evaluation
How much slower is Jass?
How much larger?
System 0.33
0.33
User 0.27
4,366
1,081
21.03
1.33
Real
0
22.33
5
10
15
20
25
Execution Time in Seconds
0
1,000
2,000
3,000
4,000
5,000
Buffer w/ Jass
Buffer w/o Jass
Size in Bytes
Buffer class w/ Jass
1 May 2000
Buffer class w/o Jass
CS655 Project Presentation
7
Conclusion
It’s a hog,
it’s slow, it’s
big...
Value inside
(Safe, reusable error-free code.)
BUT...
1 May 2000
CS655 Project Presentation
8
Java Exception Handling
1 May 2000
CS655 Project Presentation
9
Related documents