|Publication number||US7386836 B2|
|Application number||US 10/457,199|
|Publication date||Jun 10, 2008|
|Filing date||Jun 9, 2003|
|Priority date||Jun 9, 2003|
|Also published as||US7844948, US20040250239, US20080178153|
|Publication number||10457199, 457199, US 7386836 B2, US 7386836B2, US-B2-7386836, US7386836 B2, US7386836B2|
|Inventors||James E. Fox, Jordan T. Liggitt, Erich S. Magee, Robert C. Sizemore|
|Original Assignee||International Business Machines Corporation|
|Export Citation||BiBTeX, EndNote, RefMan|
|Patent Citations (34), Non-Patent Citations (1), Referenced by (8), Classifications (8), Legal Events (6)|
|External Links: USPTO, USPTO Assignment, Espacenet|
1. Field of the Invention
The present invention relates to computer programming, and deals more particularly with techniques for enabling multiple valid versions of serialized objects (such as Java™ objects) to be maintained concurrently.
2. Description of the Related Art
For data transfer in distributed computing environments, as well as for storing data persistently, it becomes necessary to convert data structures between object format and serialized format. For example, such structured objects may be used when writing programs in the Java™ programming language. (“Java”™ is a trademark of Sun Microsystems, Inc.) Other object-oriented programming languages use different names for their objects. The term “serialization” is used in the art to describe the process of taking an object and transforming it to a “flattened” data structure so that, for example, the contents of the object can be persistently stored or can be passed over a network connection in a serial or stream format. “Deserialization” then refers to the reverse process, whereby a flattened data structure is converted into object format.
In the Java™ programming language, a built-in versioning technique for serialized objects is provided. Each serializable class may declare a variable “serialVersionUID”, which is a 64-bit long integer that will store a stream-unique identifier. (See the discussion of
For example, suppose the class definition for a serialized object is as shown in
Changes in class definitions are a typical occurrence when a new version of a software product is being created. The changes may correct errors that have been discovered in an earlier version, or new features may be added to the software product which necessitate revising the class definitions. Using SUID values to maintain correct versions of serialized objects is an effective way to maintain compatibility (or to detect incompatibility) between one version of the software product and another version. Among other things, this built-in versioning technique prevents problems if a developer adds an interface to a class that does not exist in previously-serialized objects that were created according to the previous class definition, and may prevent problems when an interface from a newer version is deserialized on an older version of a consuming application, where that older version does not support that interface.
While the built-in versioning technique provides a number of advantages, there are situations in which problems arise. In particular, it may happen that developers need to make changes to the class definition of a serializable object that do not affect the class's interfaces and that do not render previously-serialized objects incompatible. For example, the change might be limited to addition of a copyright statement, or to addition or deletion of fields that are not serialized, in which case the changed class definition will not cause problems for previously-serialized objects. By definition, however, the SUID for the changed class definition will automatically change when the class definition is compiled. Therefore, objects created according to the previous class definition will necessarily be considered incompatible with the new class definition by the versioning support—even though, for a particular change, the objects may in fact still be compatible—thereby preventing those objects from being deserialized.
It is possible with the existing built-in versioning technique for a developer to override the computed SUID value, forcing it to the same value that was computed on an older version of the class. In this manner, the developer could force two different versions of a class to be considered as identical, even though they are not, so that their objects will be treated as compatible. According to the existing versioning technique, each version of a class definition, except the original version, is required to declare the stream-unique identifier, SUID. In the absence of a declaration, the SUID defaults to the hash value computed over the current class definition. Therefore, one class can be defined as backwards-compatible with another by declaring the SUID of the older class definition as the SUID for the new class definition. An example is shown at 300 in
Although this overriding would solve one problem, it would create several others, including:
Accordingly, what is needed are techniques that avoid these drawbacks of manually overriding the SUID value to set it to the SUID of a previous version, yet allow different class definitions to be treated as compatible.
An object of the present invention is to define techniques for concurrently supporting serialized objects that represent multiple different, but still valid, versions of a class definition.
Another object of the present invention is to provide programmatic mapping support for concurrently supporting multiple versions of serialized objects.
Yet another object of the present invention is to provide techniques whereby changes to class definitions that affect compatibility among versions can be documented for tracking and/or analysis.
Still another object of the present invention is to provide techniques whereby compatibility changes among versions can be programmatically detected in a manner that enables user-definable actions (such as exception logging) to be carried out.
Another object of the present invention is to enable compatibility issues to be abstracted to a layer where those issues can be managed separately from the objects themselves.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides improved methods, systems, and computer program products for enabling multiple valid versions of serialized objects to be maintained concurrently. In one embodiment, this technique comprises: determining a serialized object to be deserialized; determining a version of the serialized object; and programmatically consulting a mapping to determine whether the serialized object's version is identical to a particular version of code to be used for the deserialization, and if not, whether the serialized object's version is compatible with the particular version.
The mapping preferably stores an identifier of the particular version of code and an identifier of each of zero or more other versions of the code that are compatible with the particular version. Optionally, the mapping may also comprise comments that document differences between the particular version and at least one of the other versions. The mapping may be created by one or more developers who determines which versions of code are compatible.
The technique may further comprise substituting an identifier of the particular version for an identifier of the serialized object's version, upon determining that the serialized object's version is compatible, when providing the serialized object to code used in the deserialization. A notification of the code to be used and the serialized object's version (and, optionally, the particular version) may be created when the consulting operation determines that the serialized object's version is not identical to, or compatible with, the particular version.
The present invention will now be described with reference to the following drawings, in which like reference numbers denote the same element throughout.
The present invention defines novel techniques for concurrently maintaining serialized objects that were created from more than one version of a class definition. According to preferred embodiments, a component programmatically maps and enforces multiple valid versions of SUIDs for a collection of class definitions (such as the classes of a software product that is undergoing change from one product version to another). This component is referred to equivalently herein as a “serial version UID manager” or “mapping component”. This mapping component programmatically detects when an object's SUID value does not match the code attempting to deserialize the object, and then programmatically determines whether the object is compatible with the code even though the SUID values do not match. Preferably, this determination is made by consulting a stored mapping, as will now be described in more detail with reference to
Preferably, a separate stored mapping is used for each software product for which versioning is to be managed using techniques disclosed herein. As will be obvious,
The name of the object's class is then determined (Block 520), and this class name is used as an index to the stored mapping (Block 530). Block 540 compares the object's SUID value (i.e., the “input SUID”) to the current SUID stored in the indexed entry, to determine whether they are equal. If they are, this is an indication that the serialized object was created according to the current class definition. This object is already compatible, by definition, and the logic of
When the test in Block 540 has a negative result, Block 550 tests to see whether the object's SUID value matches any of the identified compatible SUID values stored in the indexed mapping. If not, then this object cannot be deserialized using the current class definition, and an exception is therefore generated (Block 570), and the processing of
Preferably, the exception handling performed at Block 570 comprises informing the developer (e.g., by an error message displayed on a graphical user interface or logged in an exception report) of the object's class and SUID value that have not matched the indexed entry in the mapping, so that the developer can evaluate this particular version of the class definition to determine whether it should be treated as being compatible with other versions. Preferably, the exceptions are logged to a file or other repository. Optionally, an implementation may provide for additional or different actions, which may be user-definable, to be associated with the processing at Block 570. (These types of exception handling are preferably provided by overriding the native serializable exception.)
If the developer determines that a particular version of a class definition should be treated as being compatible with other versions, then the developer preferably updates the stored mapping to reflect that determination. An “add” method is preferably provided for this purpose, which takes as input the class name, the current SUID value, and the SUID value(s) to be treated as compatible therewith. Subsequent iterations of the logic of
When the test in Block 550 has a successful result, this indicates that the techniques of the present invention can be used to treat a serialized object that was created according to one version of a class definition as being compatible with another version of that class definition (as shown at Block 560). Preferably, the processing of Block 560 comprises substituting the current SUID value, from the indexed entry, to the existing logic that checks for version compatibility. In this manner, the object appears to be compatible with the current class definition, because it appears to have the “correct” SUID value. (Notably, this approach also avoids the problems described above that result when actually overriding the SUID value in the class definition.)
When an object being deserialized contains fields that are no longer present in the current class definition, preferred embodiments preferably discard those fields (and may log their values to a file or report, if desired). If the current class definition contains fields that are not present in the serialized object, on the other hand, preferred embodiments preferably use a default value for that field in the object that is created from the deserialization.
Optionally, additional functions may be carried out at Block 560, if desired, such as logging the class name and SUID value for an object that is being treated as compatible. In addition, if comments have been provided in the indexed mapping (such as those described above with reference to
The stored mapping may be updated in a “batch” mode, for example to reflect all the compatible versions of class definitions for a particular software product each time a new version of the product is created. The entries in the stored mapping may selectively allow backwards compatibility to certain versions of class definitions, while disallowing compatibility with other versions.
Referring now to
Preferred embodiments of the present invention operate as depicted in the lower portion of
As has been demonstrated, the present invention provides novel techniques for enabling multiple serialized object versions to exist concurrently. Benefits of using techniques disclosed herein include:
While preferred embodiments have been described with reference to the Java™ programming language and its versioning support, the teachings disclosed herein may be adapted for use with similar features of other programming languages, without deviating from the scope of the present invention.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product which is embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims shall be construed to include preferred embodiments and all such variations and modifications as fall within the spirit and scope of the invention.
|Cited Patent||Filing date||Publication date||Applicant||Title|
|US5404525 *||Sep 30, 1992||Apr 4, 1995||International Business Machines Corporation||Efficient method router that supports multiple simultaneous object versions|
|US5579509 *||Feb 8, 1991||Nov 26, 1996||International Business Machines Corporation||Apparatus and method for verifying compatibility of system components|
|US5634114 *||Jul 3, 1995||May 27, 1997||Intel Corporation||Dynamic link library version negotiation|
|US5671428 *||Aug 28, 1992||Sep 23, 1997||Kabushiki Kaisha Toshiba||Collaborative document processing system with version and comment management|
|US5740405 *||Dec 17, 1992||Apr 14, 1998||Microsoft Corporation||Method and system for providing data compatibility between different versions of a software program|
|US5915112 *||Jan 2, 1996||Jun 22, 1999||International Business Machines Corporation||Remote procedure interface with support for multiple versions|
|US6112024 *||Oct 2, 1996||Aug 29, 2000||Sybase, Inc.||Development system providing methods for managing different versions of objects with a meta model|
|US6151700||Oct 20, 1997||Nov 21, 2000||International Business Machines Corporation||Object oriented distributed programming system for computer controlled networks with selective capture of program property data identifying a particular program version|
|US6272521||Dec 8, 1997||Aug 7, 2001||Object Technology Licensing Corporation||Apparatus and method for allowing object-oriented programs created with different framework versions to communicate|
|US6292933||Oct 29, 1999||Sep 18, 2001||International Business Machines Corporation||Method and apparatus in a data processing system for systematically serializing complex data structures|
|US6298353||Nov 19, 1998||Oct 2, 2001||International Business Machines Corporation||Checking serialization compatibility between versions of java classes|
|US6301585||Mar 17, 1999||Oct 9, 2001||Sun Microsystems, Inc.||Redundancy elimination in the persistence of object graphs|
|US6356946 *||Jan 19, 1999||Mar 12, 2002||Sybase Inc.||System and method for serializing Java objects in a tubular data stream|
|US6415435||Mar 18, 1999||Jul 2, 2002||International Business Machines Corporation||Method and apparatus for determining compatibility of parent classes in an object oriented environment using versioning|
|US6438559 *||Jun 7, 1999||Aug 20, 2002||Sybase, Inc.||System and method for improved serialization of Java objects|
|US6460052 *||Aug 20, 1999||Oct 1, 2002||Oracle Corporation||Method and system for performing fine grain versioning|
|US6477701||Sep 30, 1999||Nov 5, 2002||Seiko Epson Corporation||Version-adaptive serialization and deserialization of program objects in an object-oriented environment|
|US6493768 *||Feb 17, 1999||Dec 10, 2002||International Business Machines Corporation||Remote procedure interface with support for multiple versions|
|US6501852 *||Mar 10, 1999||Dec 31, 2002||International Business Machines Corporation||Method and component for serialization of images|
|US6519767 *||Jun 7, 1995||Feb 11, 2003||Microsoft Corporation||Compiler and method for automatically building version compatible object applications|
|US6898604 *||Jun 29, 2001||May 24, 2005||Microsoft Corporation||XML serialization and deserialization|
|US6928488 *||Jun 27, 2001||Aug 9, 2005||Microsoft Corporation||Architecture and method for serialization and deserialization of objects|
|US6971093 *||May 14, 2001||Nov 29, 2005||Cisco Technology, Inc.||Techniques for maintaining compatibility of a software core module and an interacting module|
|US6983447 *||Apr 3, 1995||Jan 3, 2006||International Business Machines Corporation||Efficient method router that supports multiple simultaneous object versions|
|US7150004 *||Aug 21, 2002||Dec 12, 2006||International Business Machines Corporation||Programmatically serializing complex objects using self-healing techniques|
|US7191196 *||Jun 28, 2001||Mar 13, 2007||International Business Machines Corporation||Method and system for maintaining forward and backward compatibility in flattened object streams|
|US7207002 *||Nov 13, 2003||Apr 17, 2007||International Business Machines Corporation||Serialization and preservation of objects|
|US20030005169||Jun 28, 2001||Jan 2, 2003||International Business Machines Corporation||Method and system for maintaining forward and backward compatibility in flattened object streams|
|US20030005408 *||Dec 13, 2001||Jan 2, 2003||Pradeep Tumati||System and method for creating software modifiable without halting its execution|
|US20030033442||Jul 16, 2002||Feb 13, 2003||Joel Halpern||Apparatus and method for providing a class versioning architecture|
|US20030167349 *||Apr 23, 2002||Sep 4, 2003||Petri Krohn||Handling different service versions in a server|
|US20040003034 *||Jun 27, 2002||Jan 1, 2004||Weiyun Sun||Method for notification of varying versions of code between client and server|
|US20040039964 *||Aug 21, 2002||Feb 26, 2004||International Business Machines Corporation||Programmatically serializing complex objects using self-healing techniques|
|US20040167937 *||Apr 29, 2003||Aug 26, 2004||International Business Machines Corporation||Version-insensitive serialization and deserialization of program objects|
|1||"Java(TM) Object Serialization Specification", copyright 1997-1999 Sun Microsystems, Inc.: Chapter 4 "Class Descriptors", sections 4.5 "Inspecting Serializable Classes" (p. 1 of 1) and 4.6 "Stream Unique Identifiers" (pp. 1-2 of 2); Chapter 5 "Versioning of Serializable Objects" (all 11 pages); Appendix B "Exceptions in Object Serialization" (pp. 1-2 of 2), May 27, 2003, from <http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/serial-title.doc.html>.|
|Citing Patent||Filing date||Publication date||Applicant||Title|
|US7844948||Mar 29, 2008||Nov 30, 2010||International Business Machines Corporation||Maintaining multiple valid concurrent serialized object versions|
|US7954088 *||Mar 23, 2005||May 31, 2011||Microsoft Corporation||Method and apparatus for executing unit tests in application host environment|
|US8141041 *||Jan 7, 2008||Mar 20, 2012||International Business Machines Corporation||Automated configuration updater and method for code builder|
|US8276121 *||Jun 19, 2007||Sep 25, 2012||Microsoft Corporation||Selection of versioned resource among multiple compatible versions|
|US20060218446 *||Mar 23, 2005||Sep 28, 2006||Microsoft Corporation||Method and apparatus for executing unit tests in application host environment|
|US20080178153 *||Mar 29, 2008||Jul 24, 2008||International Business Machines Corporation||Maintaining Multiple Valid Concurrent Serialized Object Versions|
|US20080320460 *||Jun 19, 2007||Dec 25, 2008||Microsoft Corporation||Fulfillment of requirement for versioned resource|
|US20090177684 *||Jan 7, 2008||Jul 9, 2009||International Business Machines Corporation||Automated configuration updater|
|U.S. Classification||717/120, 717/114, 717/170, 717/118, 717/116|
|Jun 9, 2003||AS||Assignment|
Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:FOX, JAMES E.;LIGGIT, JORDAN T.;MAGEE, ERICH S.;AND OTHERS;REEL/FRAME:014160/0428
Effective date: 20030605
|Jan 23, 2012||REMI||Maintenance fee reminder mailed|
|Apr 9, 2012||AS||Assignment|
Owner name: FACEBOOK, INC., CALIFORNIA
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:INTERNATIONAL BUSINESS MACHINES CORPORATION;REEL/FRAME:028015/0882
Effective date: 20120327
|May 25, 2012||FPAY||Fee payment|
Year of fee payment: 4
|May 25, 2012||SULP||Surcharge for late payment|
|Nov 25, 2015||FPAY||Fee payment|
Year of fee payment: 8