Table Of ContentSafe Class and Data Evolution
in Large and Long-Lived Java™ Applications
Mikhail Dmitriev
Safe Class and Data Evolution
in Large and Long-Lived Java™ Applications
A dissertation submitted for the Degree of Doctor of Philosophy, Department of Computing Science,
University of Glasgow, March 2001.
Mikhail Dmitriev
SMLI TR-2001-98 August 2001
Abstract:
Thereisagrowingclassofapplicationsimplementedinobject-orientedlanguagesthatarelargeandcom-
plex, that exploit object persistence, and need to run uninterrupted for long periods of time. Development
and maintenance of such applications can present challenges in the following interrelated areas: consis-
tent and scalable evolution of persistent data and code, optimal build management, and runtime changes
to applications.
The research presented in this thesis addresses the above issues. Since the Java™ programming lan-
guage is becoming the increasingly popular platform for implementing large and long-lived applications, it
was chosen for experiments.
M/S MTV29-01 email address:
901 San Antonio Road [email protected]
Palo Alto, CA 94303-4900
©2001SunMicrosystems,Inc.Allrightsreserved.TheSMLTechnicalReportSeriesispublishedbySunMicrosystemsLaboratories,ofSun
Microsystems, Inc. Printed in U.S.A.
Unlimitedcopyingwithoutfeeispermittedprovidedthatthecopiesarenotmadenordistributedfordirectcommercialadvantage,andcredittothe
sourceisgiven.Otherwise,nopartofthisworkcoveredbycopyrighthereonmaybereproducedinanyformorbyanymeansgraphic,electronic,
ormechanical,includingphotocopying,recording,taping,orstorageinaninformationretrievalsystem,withoutthepriorwrittenpermissionofthe
copyright owner.
TRADEMARKS
Sun,SunMicrosystems,theSunlogo,Java,andSolarisaretrademarksorregisteredtrademarksofSunMicrosystems,Inc.intheU.S.andother
countries.AllSPARCtrademarksareusedunderlicenseandaretrademarksorregisteredtrademarksofSPARCInternational,Inc.intheU.S.and
other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
ForinformationregardingtheSMLTechnicalReportSeries,contactJeanieTreichel,Editor-in-Chief<[email protected]>.Theentire
technical report collection is available online at http://research.sun.com.
Safe Class and Data Evolution
in Large and Long-Lived Java Applications
Mikhail Dmitriev
Submitted for the Degree of Doctor of Philosophy
Department of Computing Science
University of Glasgow
March 2001
c MikhailDmitriev,May2001
(cid:13)
Abstract
There is a growing class of applications implemented in object-oriented languages that are large and com-
plex, that exploit object persistence, and need to run uninterrupted for long periods of time. Development
and maintenance of such applications can present challenges in the following interrelated areas: consis-
tent and scalable evolution ofpersistent data and code, optimal build management, and runtime changes to
applications.
Theresearchpresentedinthisthesisaddressestheaboveissues. SinceJavaisbecomingincreasinglypopular
platform forimplementinglargeandlong-lived applications, itwaschosenforexperiments.
Thefirstpartoftheresearchwasundertaken inthecontextofthePJamasystem,anorthogonally persistent
platform for Java. A technology that supports persistent class and object evolution for this platform was
designed, builtandevaluated. Thistechnology integrates buildmanagement, persistent classevolution, and
supportforseveralformsofeagerconversion ofpersistent objects.
ResearchinbuildmanagementforJavahasresultedinthecreationofagenerallyapplicable, compiler-inde-
pendentsmartrecompilationtechnology,whichcanbere-usedinaJavaIDE,orasastandaloneJava-specific
utilitysimilartomake.
The technology for eager object conversion that wedeveloped allows the developers to perform arbitrarily
complex changes to persistent objects and their collections. A high level of developer’s control over the
conversion process was achieved in part due to introduction of a mechanism for dynamic renaming of old
classversions. Thismechanismwasimplementedusingminornon-standardextensionstotheJavalanguage.
However, we also demonstrate how to achieve nearly the same results without modifying the language
specification. Inthisform,webelieve, ourtechnology canbelargelyre-used withpractically anypersistent
objectsolution forJava.
The second part of this research was undertaken using as an implementation platform the HotSpot Java
Virtual Machine (JVM), which is currently Sun’s main production JVM. A technology was developed that
allows the engineers to redefine classes on-the-fly in the running VM. Our main focus was on the runtime
evolution of server-type applications, though we also address modification of applications running in the
debugger. UnliketheonlyothersimilarsystemforJavaknowntous,ourtechnologysupportsredefinitionof
classesthathavemethodscurrently active. Severalpolicies forhandling suchmethodshavebeenproposed,
oneofthemiscurrentlyoperational, anotheroneisintheexperimental stage. Wealsoproposetore-usethe
runtimeevolution technology fordynamicfine-grainprofilingofapplications.
i
ii ABSTRACT
Acknowledgements
Iamgratefultothefollowingpeoplefortheirsupport, encouragement, andconstructive contributions.
MalcolmAtkinson, myPhDsupervisor, fortheconstanthelpandencouragement, outstanding enthu-
(cid:15) siasm and ability to generate new ideas, taking care even of my non-work circumstances, and, last
butnotleast,providingthescholarship formethatcoveredbothmytuitionandlivingexpensesinthe
course of my PhD. Malcolm was a head of the PJama project in Glasgow, but also played a role in
theinitiating ofthe“HotSwap”project atSunLabs,onwhichIamcurrently working.
Craig Hamilton, for implementing the low-level evolution and object conversion mechanisms for
(cid:15) PJama, andbeingalways readytohelp. Theworkdescribed inChapter 6ofthisthesis wouldhardly
becomplete without hisparticipation. Talking toCraigforalmost three years wasalso aninvaluable
experience oflearningtounderstand aclassicScottishaccent.
MickJordan,forprovidingthefundsandequipmentthatsupportedmeinGlasgow,andforsupporting
(cid:15) myinternships atSunLabs
Gilad Bracha, whowas themain initiator of the HotSwapproject atSunLabs, provided many ofthe
(cid:15) ideasthataredevelopedinChapter7ofthisthesis, andwasalwayswillingtoadviseme.
MarioWolczko,mymanageratSunLabs,foracceptingmefirstfortheinternship, andthenforaper-
(cid:15) manentjob,givingvaluabletechnicaladvice,andconstantlyhelpingmetoresolvevariousunexpected
andmysterious bureaucratic problemsarisingallbuttoooftenintheUS.
Roberto Zicari, for reviewing (anonymously, of course — but a real expert can be recognised by
(cid:15) the quality of his writing) and providing valuable comments to my papers, which were eventually
included inthisthesis.
RobertGriesemerfromJavaSoft,forhistimespentexplainingtometheinternalsoftheHotSpotJVM,
(cid:15) reviewing my code and teaching me better coding habits, and kindly providing the text for Section
7.1.1ofthisthesis.
LarsBak,oneofthecreatorsoftheHotSpotJVM,forgivingmetheinitialtechnicaladviceonimple-
(cid:15) mentingthedynamicclassredefinition functionality.
The members of the PJama group at the University of Glasgow and at Sun Labs: Greg Czajkowski,
(cid:15) Laurent Dayne`s, Neal Gafter, Brian Lewis, Bernd Mathiske, Tony Printezis, and Susan Spence, for
theinteresting debates, helpfuladviceandenjoyable timespenttogether overthepastthreeyears.
The PJama project, within which a large part of my research was performed, was supported by a collabo-
rative research grant from Sun Microsystems, Inc., and a grant from the British Engineering and Physical
ScienceResearchCouncil(EPSRC).
iii
iv ACKNOWLEDGEMENTS
Contents
Abstract i
Acknowledgements iii
1 Introduction 1
1.1 TheJavaProgrammingLanguage andPlatform . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Enterprise Applications, ObjectPersistence andChangeManagement . . . . . . . . . . . . 5
1.2.1 Enterprise Applications andJava . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2 ObjectPersistence andJava . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.3 Evolution ofPersistent Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.4 Application Evolution andBuildManagement . . . . . . . . . . . . . . . . . . . . 8
1.2.5 RuntimeEvolution ofJavaApplications . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3 ThesisStatement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 ThesisOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 PJamaSystemandItsEvolutionModel 13
2.1 PJamaPersistentPlatform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.1 Orthogonal Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.2 HistoryofthePJamaProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.3 PJamaPersistence ModelOverview . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Requirements forthePJamaEvolutionTechnology . . . . . . . . . . . . . . . . . . . . . . 24
2.3 MainFeaturesofthePJamaEvolution Technology . . . . . . . . . . . . . . . . . . . . . . 24
2.3.1 TheHistoryofEvolution ToolsForPJama. . . . . . . . . . . . . . . . . . . . . . . 25
2.3.2 TheFrontEnd—theopjbPersistentBuildTool . . . . . . . . . . . . . . . . . . . 27
2.3.3 SupportforOperationsontheClassHierarchy . . . . . . . . . . . . . . . . . . . . 28
2.3.4 SupportforObjectConversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 PJamaEvolutionSystemArchitecture Overview . . . . . . . . . . . . . . . . . . . . . . . . 29
2.5 ThePresentConstraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.5.1 NoOn-LineorConcurrent Evolution . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.5.2 NoLazyObjectConversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.5.3 NoSupportforJavaCoreClassesEvolution . . . . . . . . . . . . . . . . . . . . . . 32
2.6 RelatedWork—OODBSystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.6.1 GeneralApproaches toChangeManagement . . . . . . . . . . . . . . . . . . . . . 33
2.6.2 TypesofChangesAllowed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.6.3 DataandCodeConsistency Preservation . . . . . . . . . . . . . . . . . . . . . . . 35
2.6.4 SupportforEvolutioninJavaBinding . . . . . . . . . . . . . . . . . . . . . . . . . 36
v