ABSTRACT
Exception mechanisms help to ensure that a program satisfies the important robustness criterion of dependency safety: if an operation fails, no code that depends on the operation's successful completion is executed anymore nor will wait for the completion. However, the exception handling mechanisms available in languages like Java do not provide a structured way to achieve dependency safety. The language extension failbox provides dependency safety for Java in a compositional manner. So far, there only exists an implementation of failbox in Scala. It requires the assumption of absence of asynchronous exceptions inside the failbox code. In this paper, we are the first to provide an implementation without the above mentioned assumption, this time in Java. First, we present and discuss a direct reimplementation of failbox in Java that is still restricted. Then, we show that using uncaught exception handlers the earlier assumption can be essentially weakened to only concern code before setting the thread handler. Finally, we provide an implementation using the Java native interface that completely removes the assumption.
- J. Armstrong. Making Reliable Distributed Systems in the Presence of Software Errors. PhD thesis, Royal Institute of Technology, Stockholm, Sweden, 2003.Google Scholar
- M. Bagherzadeh, H. Rajan, and M. A. D. Darab. On Exceptions, Events and Observer Chains. In AOSD, pages 185--196, 2013. Google ScholarDigital Library
- D. Bošnački, M. van den Brand, J. Gabriels, B. Jacobs, R. Kuiper, S. Roede, A. Wijs, and D. Zhang. Towards Modular Verification of Threaded Concurrent Executable Code Generated from DSL Models. In Formal Aspects of Component Software - 12th International Conference, FACS 2015, Niterói, Brazil, October 14-16, 2015, pages 141--160, 2015. Google ScholarDigital Library
- P. Felber, C. Fetzer, V. Gramoli, D. Harmanci, and M. Nowack. Safe Exception Handling with Transactional Memory. In Transactional Memory. Foundations, Algorithms, Tools, and Applications, pages 245--267, 2015.Google Scholar
- C. Fetzer, K. Högstedt, and P. Felber. Automatic Detection and Masking of Non-Atomic Exception Handling. In 2003 International Conference on Dependable Systems and Networks, 22-25 June 2003, San Francisco, CA, USA, pages 445--454, 2003.Google Scholar
- J. Gosling, B. Joy, G. Steele, G. Bracha, and A. Buckley. The Java Language Specification. Java SE 8 Edition, 2015. Google ScholarDigital Library
- B. Jacobs. Provably Live Exception Handling. In Proceedings of the 17th Workshop on Formal Techniques for Java-like Programs, Prague, Czech Republic, July 7, 2015, pages 7:1--7:4, 2015. Google ScholarDigital Library
- B. Jacobs, D. Bosnacki, and R. Kuiper. Modular Termination Verification: Extended Version. Cw reports, Katholieke Universiteit Leuven, 2015.Google Scholar
- B. Jacobs, P. Müller, and F. Piessens. Sound Reasoning about Unchecked Exceptions. In Proceedings ICFEM, 2007.Google ScholarDigital Library
- B. Jacobs and F. Piessens. Failboxes: Provably Safe Exception Handling. In ECOOP, pages 470--494. Springer, 2009. Google ScholarDigital Library
- G. Lagorio and M. Servetto. Strong Exception-Safety for Checked and Unchecked Exceptions. Journal of Object Technology, 10(1):1--20, 2011.Google Scholar
- N. D. Matsakis and T. R. Gross. Handling Errors in Parallel Programs Based on Happens Before Relations. In 24th IEEE International Symposium on Parallel and Distributed Processing, Atlanta, Georgia, USA, 19-23 April 2010, pages 1--8, 2010.Google Scholar
- H. Rebêlo, R. Coelho, R. M. F. Lima, G. T. Leavens, M. Huisman, A. Mota, and F. Castor. On the Interplay of Exception Handling and Design by Contract: An Aspect-Oriented Recovery Approach. In Proceedings of the 13th Workshop on Formal Techniques for Java-Like Programs, Lancaster, United Kingdom, July 25-29, 2011, pages 7:1--7:6, 2011. Google ScholarDigital Library
- N. Shavit and D. Touitou. Software Transactional Memory. In Proceedings of the Fourteenth Annual ACM Symposium on Principles of Distributed Computing, Ottawa, Canada, August 20-23, 1995, pages 204--213, 1995. Google ScholarDigital Library
- S. Toub. Keep Your Code Running with the Reliability Features of the .NET Framework. MSDN Magazine, October 2015.Google Scholar
- D. Zhang, D. Bošnački, M. van den Brand, L. Engelen, C. Huizing, R. Kuiper, and A. Wijs. Towards Verified Java Code Generation from Concurrent State Machines. In AMT@ MoDELS, pages 64--69, 2014.Google Scholar
Recommendations
Dependency safety for Java – Implementing and testing failboxes
Highlights- We present a testing framework tailor-made for testing how multi-threaded Java programs handle asynchronous exceptions.
AbstractException mechanisms help to ensure that a program satisfies the important robustness criterion of dependency safety: if an operation fails in an execution sequence, any code depending on the successful completion of this operation ...
Efficient Java exception handling in just-in-time compilation
Research ArticlesJava uses exceptions to provide elegant error handling capabilities during program execution. However, the presence of exception handlers complicates the job of the just-in-time (JIT) compiler, while exceptions are rarely used in most programs. This ...
Supporting exception handling for futures in Java
PPPJ '07: Proceedings of the 5th international symposium on Principles and practice of programming in JavaA future is a simple and elegant construct that programmers can use to identify potentially asynchronous computation and to introduce parallelism into serial programs. In its recent 5.0 release, Java provides an interface-based implementation of futures ...
Comments