skip to main content
10.1145/1167473.1167485acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Uniform proxies for Java

Published:16 October 2006Publication History

ABSTRACT

The proxy abstraction has a longlasting tradition in object settings. From design pattern to inherent language support, from remote method invocations to simple forms of behavioral reflection - incarnations as well as applications of proxies are innumerable.Since version 1.3, Java supports the concept of dynamic proxy. Such an object conforms to a set of types specified by the program and can be used wherever an expression of any of these types is expected, yet reifies invocations performed on it. Dynamic proxies have been applied to implement paradigms as diverse as behavioral reflection, structural conformance, or multi-methods. Alas, these proxies are only available "for interfaces". The case of creating dynamic proxies for a set of types including a class type has not been considered, meaning that it is currently not possible to create a dynamic proxy mimicking an instance of a given class. This weakness strongly limits any application of dynamic proxies.In this paper we unfold the current support for dynamic proxies in Java, assessing it in the light of a set of generic criteria for proxy implementations. We present an approach to supporting dynamic proxies "for classes" in Java, consisting in transformations performed on classes at load-time, including a generic scheme for enforcing encapsulation upon field accesses. These transformations seemlessly extend the scope of the current support for dynamic proxies. We discuss the precise benefits and costs of our extension in terms of the criteria introduced, and illustrate the usefulness of uniformly available proxies by implementing future method invocations both safely and transparently.

References

  1. O. Agesen, S. N. Freund, and J. C. Mitchell. Adding Type Parameterization to the Java Language. In Proceedings of the 12th ACM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '97), pages 49--65, October 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Alpern, A. Cocchi, S. Fink, and D. Grove. Efficient Implementation of Java Interfaces: Invokeinterface Considered Harmless. In Proceedings of the 16th ACM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2001), pages 108--124, October 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. D. Bacon. Kava: A Java Dialect with a Uniform Object Model for Lightweight Classes. In Proceedings of the Joint ACM Java Grande - ISCOPE 2002 Conference, pages 68--77, June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. D. Caromel, W. Klauser, and J. Vayssiè re.Towards Seamless Computing and Metacomputing in Java .Concurrency: Prac-tice and Experience, 10(11--13):1043--1061, September 1998.]]Google ScholarGoogle Scholar
  5. D. Caromel and J. Vayssière. Reflections on MOPs, Components, and Java Security. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP 2001), pages 256--274, June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Chiba. Loadtime Structural Reflection in Java. In Proceedings of the 14th European Conference on Object-Oriented Programming (ECOOP 2000), pages 313--336, June 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Eliasson. Implement Design by Contract for Java using Dynamic Proxies. http://www.javaworld.com/javaworld/jw-02-2002/jw-0215-dbcproxy.html, February 2002.]]Google ScholarGoogle Scholar
  8. P. Th. Eugster and S. Baehni. Object-Oriented Programming in Peer-to-Peer Systems. Concurrency and Computation: Practice and Experience , 17(7-8):1053--1078, June 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns, Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Golm and J. Kleinöder. Jumping to the Meta Level: Behavioral Reflection Can Be Fast and Flexible. In Proceedings of the 2nd ACM International Conference on Metalevel Architectures and Reflection (Reflection '99), 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. L. Gong. Inside Java 2 Platform Security: Architecture, API, Design and Implementation. Addison-Wesley, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Herlihy and J. Wing. Linearizability: a correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems, 12(3):463--492, July 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. JBoss.JBoss 3.0. http://www.jboss.org, 2003.]]Google ScholarGoogle Scholar
  14. Kalixia. jAdvise. http://www.kalixia.com/weblogs/space/jAdvise, 2003.]]Google ScholarGoogle Scholar
  15. R. Keller and U. Hölzle. Binary Component Adaptation. In Proceedings of the 12th European Conference on Object-Oriented Programming (ECOOP '98), pages 307--329, July 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. G. Kiczales, J. des Rivières, and D. G. Bobrow. The Art of the Metaobject Protocol. MIT Press, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. G. Kiczales, J. Lamping, A. Menhdhekar, Ch. Maeda, C. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-Oriented Programming. In Proceedings of the 11th European Conference on Object-Oriented Programming (ECOOP '97), pages 220--242, June 1997.]]Google ScholarGoogle ScholarCross RefCross Ref
  18. J. Kienzle and R. Guerraoui. AOP: Does It Make Sense? The Case of Concurrency and Failures. In Proceedings of the 16th European Conference on Object-Oriented Programming (ECOOP 2002), pages 37--61, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. H. Liebermann. Using Prototypical Objects to Implement Shared Behavior in Object-Oriented Systems. In Proceedings of the ACM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '86), pages 214--223, September 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, 2nd edition, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. B. Meyer. Applying Design by Contract. IEEE Computer, 25(10):40--51, October 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. P. Pratikakis, J. Spacco, and M. Hicks. Transparent Proxies for Java Futures. In Proceedings of the 19th ACM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2004), pages 206--223, October 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. F. Rivard. Smalltalk: A Reflective Language. In Proceedings of the 1st International Conference on Metalevel Architectures and Reflection (Reflection '96), pages 21--38, April 1996.]]Google ScholarGoogle Scholar
  24. M. Shapiro. Structure and Encapsulation in Distributed Systems: The Proxy Principle. In Proceedings of the 6th IEEE International Conference on Distributed Computing Systems (ICDCS '86), pages 198--204, May 1986.]]Google ScholarGoogle Scholar
  25. Sun. Dynamic Proxy Classes, 1999.]]Google ScholarGoogle Scholar
  26. Sun. Java Core Reflection API and Specification, 1999.]]Google ScholarGoogle Scholar
  27. Sun. The Java Platform 1.5 API Specification, 2004.]]Google ScholarGoogle Scholar
  28. M. Tatsubori, T. Sasaki, S. Chiba, and K. Itano. A Bytecode Translator for Distributed Execution of "Legacy" Java Software. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP 2001), pages 236--244, June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. T. Thai and H. Lam. .NET Framework Essentials. O'Reilly and Associates, Inc., June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Welc, S. Jagannathan, and A. L. Hosking. Transactional Monitors for Concurrent Objects. In Proceedings of the 18th European Conference on Object-Oriented Programming (ECOOP 2004), pages 519--542, June 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  31. A. Welc, S. Jagannathan, and A. L. Hosking. Safe Futures for Java. In Proceedings of the 20th ACM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2005), pages 439--453, October 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. I. Welch and R. Stroud. From Dalang to Kava: the Evolution of a Reflective Java Extension. In Proceedings of the 2nd ACM International Conference on Metalevel Architectures and Reflection (Reflection '99), pages 2--21, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. I. Welch and R. J. Stroud. Kava-Using Byte Code Rewriting to Add Behavioural Reflection to Java. In Proceedings of the 6th Usenix Conference on Object-Oriented Technologies and Systems (COOTS'01), pages 119--130, January 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. A. Yonezawa, E. Shibayama, T. Takada, and Y. Honda. Object-Oriented Concurrent Programming, chapter 4: Modeling and Programming in an Object-Oriented Concurrent Language ABCL/1, pages 55--89. MIT Press, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Uniform proxies for Java

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!