Dynamic Instrumentation of Distributed Java Applications Using Bytecode Modifications W lodzimierz Funika and Pawel Swierszcz Inst. Comp. Science, AGH-UST, al. Mickiewicza 30, 30-059 Krakow, Poland funika@uci.agh.edu.pl Tel.: (+48 12) 617 44 66; Fax: (+48 12) 633 80 54 Abstract. Java’s features such as system platform independence, dynamic and network oriented architecture, robustness as well as grow- ing number of common standards make it a language of choice for many projects. However an increasing complexity of created software and re- quirement for high stability and high quality of applications make it de- sirable for a developer to inspect, monitor, debug or in any way alter Java programs behaviour on-the-fly. The main goal of this paper is to present the design of a system for instrumenting Java classes at runtime. This system is to aid developer in modifying program by adding fragments of code at specific locations that implement some new functionality. This allows programmer to enhance classes with logging, monitoring, caching or any other capabilities that are required at run-time. Keywords: Java, instrumentation, bytecode, J-OMIS, J-OCM. 1 Introduction With the fast increasing power of modern computers equipped with more and more advanced processing units, memory and disk resources more complex and larger applications are created. Rapidly developing networking made distributed systems common as network-enabled computers are standard. Additionally, mod- ern systems are often assembled from components coming from different vendors, sometimes running on quite different platforms and not fully compliant to im- plemented standards. This makes applications prone to errors, unpredicted be- haviour, runtime flaws, deadlocks and all kinds of programmer mistakes. Java is a leading solution for developing modern, object-oriented software, being a platform for a great number of advanced systems in various use cases both scientific projects and business oriented applications. Together with this comes greater effectiveness of software production in many domains from mo- bile devices to large scale systems and middle-tier integration of heterogeneous legacy solutions. Java is also successfully applied to massive computational tasks executed on a farm of high performance servers or quite contrary in distributed environment or for example grid network. Corresponding author. V.N. Alexandrov et al. (Eds.): ICCS 2006, Part II, LNCS 3992, pp. 534–541, 2006. c Springer-Verlag Berlin Heidelberg 2006