Skip to main content

Type-Safe Eventful Sessions in Java

  • Conference paper
ECOOP 2010 – Object-Oriented Programming (ECOOP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6183))

Included in the following conference series:

Abstract

Event-driven programming is a major paradigm in concurrent and communication-based programming, and a widely adopted approach to building scalable high-concurrency servers. However, traditional event-driven programs are more difficult to read, write and verify than their multi-threaded counterparts due to low-level APIs and fragmentation of control flow across disjoint event handlers. This paper presents a Java language extension and a novel type discipline for type-safe event-driven session programming that counters the problems of traditional event-based programming with abstractions and safety guarantees based on session types, while retaining the expressiveness and performance characteristics of events. The type discipline extends session types and their primitives with asynchronous input, session typecase and session set types, ensuring event-handling safety and event progress in addition to the standard type soundness and communication safety. The advantages, expressiveness and performance of event-driven session programming are demonstrated through a range of examples and benchmarks, including a session-typed SMTP server.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Cardelli, L., Pierce, B.C., Plotkin, G.D.: Dynamic typing in a statically typed language. TOPLAS 13(2), 237–268 (1991)

    Article  Google Scholar 

  2. Adya, A., Howell, J., Theimer, M., Bolosky, W.J., Douceur, J.R.: Cooperative task management without manual stack management or, event-driven programming is not the opposite of threaded programming. In: USENIX ATC 2002, pp. 289–302. USENIX Association (2002)

    Google Scholar 

  3. Benton, N., Cardelli, L., Fournet, C.: Modern concurrency abstractions for C#. TOPLAS 26(5), 769–804 (2004)

    Article  Google Scholar 

  4. Bettini, L., et al.: Global progress in dynamically interleaved multiparty sessions. In: van Breugel, F., Chechik, M. (eds.) CONCUR 2008. LNCS, vol. 5201, pp. 418–433. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  5. Caires, L., Vieira, H.T.: Conversation types. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 285–300. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  6. Castagna, G., Padovani, L.: Contracts for mobile processes. In: Bravetti, M., Zavattaro, G. (eds.) CONCUR 2009. LNCS, vol. 5710, pp. 211–228. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  7. Dezani-Ciancaglini, M., Mostrous, D., Yoshida, N., Drossopoulou, S.: Session types for object-oriented languages. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 328–352. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  8. Eugster, P., Jayaram, K.R.: EventJava: An extension of Java for event correlation. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 570–594. Springer, Heidelberg (2009)

    Google Scholar 

  9. Fähndrich, M., Aiken, M., Hawblitzel, C., Hodson, O., Hunt, G., Larus, J.R., Levi, S.: Language support for fast and reliable message-based communication in Singularity OS. In: EuroSys 2006, ACM SIGOPS, pp. 177–190. ACM, New York (2006)

    Google Scholar 

  10. Fournet, C., Laneve, C., Maranget, L., Rémy, D.: Inheritance in the Join calculus. JLAP 57(1-2), 23–69 (2003)

    MATH  Google Scholar 

  11. Gay, S.J., Vasconcelos, V.T., Ravara, A., Gesbert, N., Caldeira, A.Z.: Modular session types for distributed object-oriented programming. In: POPL 2010, vol. 45, pp. 299–312. ACM, New York (2010)

    Google Scholar 

  12. Haller, P., Odersky, M.: Scala actors: Unifying thread-based and event-based programming. Theoretical Computer Science 410(2-3), 202–220 (2009)

    Article  MATH  MathSciNet  Google Scholar 

  13. Honda, K., Tokoro, M.: An object calculus for asynchronous communication. In: America, P. (ed.) ECOOP 1991. LNCS, vol. 512, pp. 133–147. Springer, Heidelberg (1991)

    Chapter  Google Scholar 

  14. Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type disciplines for structured communication-based programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  15. Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: POPL 2008, pp. 273–284. ACM, New York (2008)

    Chapter  Google Scholar 

  16. Hu, R., Yoshida, N., Honda, K.: Session-based distributed programming in Java. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 516–541. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  17. Java New I/O APIs, http://java.sun.com/j2se/1.4.2/docs/guide/nio/

  18. Kouzapas, D.: A session type discipline for event driven programming models. Master’s thesis, Imperial College London (2009), http://www.doc.ic.ac.uk/teaching/distinguished-projects/2010/d.kouzapas.pdf

  19. Krohn, M.: Building secure high-performance web services with OKWS. In: USENIX ATC 2004, pp. 185–198. USENIX Association (2004)

    Google Scholar 

  20. Krohn, M., Kohler, E., Kaashoek, M.F.: Events can make sense. In: USENIX ATC 2007, pp. 1–14. USENIX Association (2007)

    Google Scholar 

  21. Lauer, H.C., Needham, R.M.: On the duality of operating system structures. SIGOPS Operating Systems Review 13(2), 3–19 (1979)

    Article  Google Scholar 

  22. Li, P., Zdancewic, S.: Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. SIGPLAN Not. 42(6), 189–199 (2007)

    Article  Google Scholar 

  23. Mostrous, D., Yoshida, N.: Session-based communication optimisation for higher-order mobile processes. In: Curien, P.-L. (ed.) TLCA 2009. LNCS, vol. 5608, pp. 203–218. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  24. Polyglot homepage, http://www.cs.cornell.edu/Projects/polyglot/

  25. SJ homepage, http://www.doc.ic.ac.uk/~rhu/sessionj.html

  26. The Simple Mail Transfer Protocol, http://tools.ietf.org/html/rfc5321

  27. Snoeren, A.C., Balakrishnan, H.: An end-to-end approach to host mobility. In: MOBICOM 2000, pp. 155–166. ACM, New York (2000)

    Chapter  Google Scholar 

  28. Takeuchi, K., Honda, K., Kubo, M.: An interaction-based language and its typing system. In: Halatsis, C., Philokyprou, G., Maritsas, D., Theodoridis, S. (eds.) PARLE 1994. LNCS, vol. 817, pp. 398–413. Springer, Heidelberg (1994)

    Google Scholar 

  29. von Behren, R., Condit, J., Brewer, E.: Why events are a bad idea (for high-concurrency servers). In: HOTOS 2003, p. 4. USENIX Association (2003)

    Google Scholar 

  30. von Behren, R., Condit, J., Zhou, F., Necula, G.C., Brewer, E.: Capriccio: scalable threads for Internet services. In: SOSP 2003, pp. 268–281. ACM, New York (2003)

    Chapter  Google Scholar 

  31. Welsh, M., Culler, D.E., Brewer, E.A.: Seda: An architecture for well-conditioned, scalable Internet services. In: SOSP 2001, pp. 230–243. ACM, New York (2001)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hu, R., Kouzapas, D., Pernet, O., Yoshida, N., Honda, K. (2010). Type-Safe Eventful Sessions in Java. In: D’Hondt, T. (eds) ECOOP 2010 – Object-Oriented Programming. ECOOP 2010. Lecture Notes in Computer Science, vol 6183. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14107-2_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14107-2_16

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14106-5

  • Online ISBN: 978-3-642-14107-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics