Java/C++ Exceptions and Message Logging Language-independent exception definition/handling and general message logging. (Adventures in Middleware) Ron.

Slides:



Advertisements
Similar presentations
Chapter 17 Failures and exceptions. This chapter discusses n Failure. n The meaning of system failure. n Causes of failure. n Handling failure. n Exception.
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
COM vs. CORBA.
Yoshi
Exception Handling. Background In a perfect world, users would never enter data in the wrong form, files they choose to open would always exist, and code.
Exceptions1 Syntax, semantics, and pragmatics. Exceptions2 Syntax, semantics, pragmatics Syntax –How it looks, i.e. how we have to program to satisfy.
EXCEPTIONS. What’s an exception?? Change the flow of control when something important happens ideally - we catch errors at compile time doesn’t happen.
Exceptions1 Syntax, semantics, and pragmatics. Exceptions2 Syntax, semantics, pragmatics Syntax –How it looks, i.e. how we have to program to satisfy.
Java Exceptions. Types of exceptions  Checked exceptions: A checked exception is an exception that is typically a user error or a problem that cannot.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Java/C++ eExceptions and Message Logging Language-independent exception definition/handling and general message logging. (Adventures in Middleware) Ron.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
II. Middleware for Distributed Systems
Copyright © Stanford Linear Accelerator Center 2002 All rights reserved Copyright © Stanford Linear Accelerator Center 2002 All rights reserved Accelerator.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
G51FSE Version Control Naisan Benatar. Lecture 5 - Version Control 2 On today’s menu... The problems with lots of code and lots of people Version control.
Exceptions. Many problems in code are handled when the code is compiled, but not all Some are impossible to catch before the program is run  Must run.
Common Object Request Broker Architecture CORBA. RMI is a simplified version of CORBA that does fairly well CORBA is all-singing and all-dancing Multiple.
1 Web Based Programming Section 6 James King 12 August 2003.
Common Object Request Broker Architecture (CORBA) CS-328.
Chapter 13 Exception Handling F Claiming Exceptions F Throwing Exceptions F Catching Exceptions F Rethrowing Exceptions  The finally Clause F Cautions.
1 Exceptions and error handling. 2 Java exception mechanism when an error or exceptional condition occurs, you throw an exception which is caught by an.
COMPUTER PROGRAMMING 2 Exceptions. What are Exceptions? Unexpected events that happen when the code is executing (during runtime). Exceptions are types.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
ACS Error System Using it in JAVA Sohaila Lucero NRAO.
Remote Procedure Call Andrew Whitaker CSE451. Remote Procedure Call RPC exposes a programming interface across machines: interface PriceService { Price.
Exceptions1 Syntax, semantics, and pragmatics. Exception create If (some error){ throw new SomeException(”some message”); } Exceptions2.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
1 Distributed Systems Distributed Objects & Remote Invocation II (CORBA VS DCOM) Dr. Sunny Jeong. With Thanks to.
Information Management NTU Interprocess Communication and Middleware.
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
Chapter 13 Recursion. Learning Objectives Recursive void Functions – Tracing recursive calls – Infinite recursion, overflows Recursive Functions that.
Exceptions Handling Exceptionally Sticky Problems.
Jan Hatje, DESY CSS ITER March 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
JSP Exception Handling 20-Oct-15. JSP - E XCEPTION H ANDLING When you are writing JSP code, a programmer may leave a coding errors which can occur at.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Introduction to Exception Handling and Defensive Programming.
Abhishek Bachchan Vishal Patangia
ACS Error System APIs: C++ Bogdan Jeram European Southern Observatory July 2005ESO.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
Conveying Information to Users. Outline Types of information in GridChem Inconsistency = confusion Appropriate UI for different information types Examples.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Stacks The content for these slides was originally created by Gerard Harrison. Ported to C# by Mike Panitz.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Exceptions and Assertions Chapter 15 – CSCI 1302.
January 25, 2016 First experiences with CORBA Niko Neufeld.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
1 Distributed Programming low level: sending data among distributed computations higher level: supporting invocations among distributed computations network.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Lecture10 Exception Handling Jaeki Song. Introduction Categories of errors –Compilation error The rules of language have not been followed –Runtime error.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Chapter 9: Continuing Classes By Matt Hirsch. Table Of Contents 1.Static Fields and Methods 2.Inheritance I. Recycle Code with Inheritance II. Overriding.
Exception testing Aistis Karkauskas, IFM-2/2. Introduction  Exceptions – anomalous or exceptional events requiring special processing – often changing.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Throwable ErrorException RuntimeException.
Chapter 13 Recursion Copyright © 2016 Pearson, Inc. All rights reserved.
Stacks The content for these slides was originally created by Gerard Harrison. Ported to C# by Mike Panitz.
Google Web Toolkit Tutorial
CORBA Alegria Baquero.
Software Development Handing Errors and Creating Documentation
What is RMI? Remote Method Invocation
CORBA Alegria Baquero.
Exceptions Problems in a Java program may cause exceptions or errors representing unusual or invalid processing. An exception is an object that defines.
Tango in a Nutshell 31/12/2018.
Nominal Technologies for Modelling and High Level Applications of LCLS
System Models Bina Ramamurthy 9/7/2019 B.Ramamurthy.
Presentation transcript:

Java/C++ Exceptions and Message Logging Language-independent exception definition/handling and general message logging. (Adventures in Middleware) Ron MacKenzie, Greg White

Why is this important? Highly distributed control system with thousands of instances of programs. Coherent and Reliable message logging is essential for keeping the system running. It is necessary to convey the context in which an exception was thrown in distributed multitiered environment. –Call Stack often lost (by serialization) –Layered application context needed. –Solution: Exception Chaining provides context.

High-speed Network

Features Language Independence (Java and C++) Define the exceptions that C++ and Java apps throw all in one place. Standard High level set of Exceptions (like DataNotFound). Corba IDL is used for exception definition Encapsulate details when exceptions occur. More details can be added when logged. Informational and Slow Speed Data logging are other uses. Corba Event Service is used for transport. IONA Orbacus is the ORB (distributed Objects++).

Data Flow Data Flow

Features (cont) Message logging will never block the application. Err.log is resilient. –If Err.log can’t connect to Event Service, message will simply be logged to stderr. –If Event Service is bounced, Err.log will reconnect on next log call.

ErrClient and Loggers ErrClient is a Corba Pull Consumer ErrClient and CmLogger are pure java. It is easy to plug in other logger classes.

ErrClient and Logger auto-reconnect. If the event service is down, ErrClient process reconnects automatically when the event service is brought back up. When the message destination (e.g. CMLOG) is down, the CmLogger process reconnects automatically when it is brought back up.

IDL Defined Structure Exception Transporter is a simple structure. Send it across the Event Service. #ifndef EXTRANS_IDL #define EXTRANS_IDL /** * IDL for exTrans. This is the Error Transporter object (structure). * 10-May-2003, Ronm. */ #pragma prefix "slac.stanford.edu" module err { struct ExceptionTransporter { string destination; // Which logger this msg is going to. string name; string suppl; long time; // IDL long is java int. string facility; string host; }; #endif

An outline the use of “Any” Exception Transporter struct defined in IDL –ExceptionTransporter et = new ExceptionTransporter (fill fields here); Push the Corba Any –Any any = orb.create_any(); –ExceptionTransporterHelper.insert(any, et); –pushMessage( any ); Pull the Corba Any –ExceptionTransporter et = new ExceptionTransporter(); –Any any = null; –any = supplier.pull(); –et = ExceptionTransporterHelper.extract(any);

Part II Application Programmer’s Perspective Err and Except Classes

Except Class (definitions) All exceptions defined in one file –$CD_SOFT/ref/package/except/idl/except.idl –To add new exceptions Cvs checkout, add the exception, cvs commit Gmake Presto! Java and C++ include files created. –IDL Examples exception UnableToGetDataException {}; exception NameLookupException {}; exception MonitorStartupException {};

Using the Err class Include/Import –JAVA –import edu.stanford.slac.except.*; // exceptions –import edu.stanford.slac.err.*; // Err logger –C++ –#include "except.h" –#include "err.h"

Using the Err class (cont) Instantiate –JAVA –Err err("AIDA Magnet Server"); Instantiate with facility name –C++ –Err err("AIDA Magnet Server"); *Err is singleton design pattern

The Err class and exception chaining A logged exception consists of three strings which are concatenated to form the logged message – EXCEPTION_NAME + REASON STRING + SUPPLEMENTAL STRING new NoDataSourceException ("forLB60:DCCT:SUNY"); err.log (ex, "while acquiring the LER current"); Logged Message: –"NoDataSourceException for LB60:DCCT:SUNY when acquiring the LER current“ A form of Exception Chaining!

Using the Err class (cont) ESD exceptions are sub classed from Java Throwable, so they are thrown and caught like other Java exceptions. try {... throw new NoDataSourceException("forLB60:DCCT:SUNY"); } catch (Exception ex) { err.log(ex, "when attempting to acquire the LER current" ); } Logged Message: "NoDataSourceException for LB60:DCCT:SUNY when attempting to acquire the LER current"

Using the Err class (cont) Err.log returns an exception, so you can log and throw an exception in one statement like this: throw err.log(new NoDataSourceException("forLB60:DCCT:SUNY"), " when starting ca service");

Development Tools Formal internal review with action items tracked. Emacs, IDL Gmake (GNU) / ESD Unix Dev Environment Gdb (C++ debug) CVS, CVS-WEB ESD Process management (shell scripts / ssh).

Deliverables Requirements/Design document Programmer’s guide System Administrator’s guide Javadoc Test and Example programs All tied together on web page

Project Status Delivered and in production!