IP Library Granted Patent US 9,189,206
Granted Patent B2
US 9,189,206 · App. 13/899,294 · Granted Nov 17, 2015

System and method for managing immutable objects

Inventors: Filip Eliá{hacek over (s)} (Vysni Lhoty, CZ); Filip Nguyen (Brno, CZ)
Assignee: Red Hat, Inc.
G06F8/24G06F8/20G06F9/45504
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,189,206
App. No.
13/899,294
Granted
Nov 17, 2015
Kind
B2
Abstract

A system and method of managing immutable objects includes monitoring new object construction, detecting construction of an object, determining a key for the object, looking the key up in a persistent storage system, when the key is found in the persistent storage system, loading the object from the persistent storage system, and when the key is not found in the persistent storage system constructing the object, determining whether the object is immutable, and storing the object in the persistent storage system when the object is immutable. In some examples, determining whether the object is immutable includes examining each primitive type data member of the object, examining each reference type constructor parameter of the object to determine whether the reference type constructor parameter is defensively copied, examining all function calls used by the object to determine whether the function calls preserve immutability, and recursively examining each reference type data member of the object.

Claims (70)

1. A method of managing immutable objects, the method comprising:

monitoring new object construction;

detecting construction of an object;

determining a key for the object;

looking the key up in a persistent storage system;

when the key is found in the persistent storage system, loading the object from the persistent storage system; and

when the key is not found in the persistent storage system:

constructing the object;

determining whether the object is immutable; and

storing the object in the persistent storage system when the object is immutable;

wherein determining whether the object is immutable comprises:

examining each primitive type data member of the object;

examining each reference type constructor parameter of the object to determine whether the reference type constructor parameter is defensively copied;

examining all function calls used by the object to determine whether the function calls preserve immutability; and

recursively examining each reference type data member of the object.

2. The method of claim 1 wherein monitoring new object construction comprises monitoring new object construction in a virtual machine.

3. The method of claim 2 wherein the virtual machine is an extended Java virtual machine.

4. The method of claim 1 , further comprising deserializing the object after loading the object from the persistent storage system.

5. The method of claim 1 , further comprising serializing the object before storing the object in the persistent storage system.

6. The method of claim 1 wherein the key comprises a class name associated with the object, parameters of a constructor used to construct the object, and an archive identifier associated with the object.

7. The method of claim 6 wherein the constructor parameters are serialized.

8. The method of claim 1 wherein looking the key up in the persistent storage system comprises querying a database.

9. The method of claim 1 wherein monitoring new object construction comprises using an augmented new operator.

10. The method of claim 1 wherein looking the key up in the persistent storage system comprises matching the key against one or more key-value pairs stored in the persistent storage system.

11. The method of claim 1 wherein the persistent storage system stores one or more key-value pairs wherein a value in each key-value pair corresponds to an immutable object identified by a corresponding key in the key-value pair.

12. The method of claim 1 wherein examining each primitive type data member of the object comprises:

determining whether the primitive type data member is designated as final;

determining whether the primitive type data member is altered as a result of a call made to a public member function of the object; and

determining whether the primitive type data member is initialized using a non-deterministic method.

13. A non-transitory machine-readable medium comprising a first plurality of machine-readable instructions which when executed by one or more processors associated with one or more computing systems are adapted to cause the one or more processors to perform a method comprising:

monitoring new object construction;

detecting construction of an object;

determining a key for the object;

looking the key up in a persistent storage system;

when the key is found in the persistent storage system, loading the object from the persistent storage system; and

when the key is not found in the persistent storage system:

constructing the object;

determining whether the object is immutable; and

storing the object in the persistent storage system when the object is immutable;

wherein determining whether the object is immutable comprises:

examining each primitive type data member of the object;

examining each reference type constructor parameter of the object to determine whether the reference type constructor parameter is defensively copied;

examining all function calls used by the object to determine whether the function calls preserve immutability; and

recursively examining each reference type data member of the object.

14. The non-transitory machine-readable medium of claim 13 wherein examining each primitive type data member of the object comprises:

determining whether the primitive type data member is designated as final;

determining whether the primitive type data member is altered as a result of a call made to a public member function of the object; and

determining whether the primitive type data member is initialized using a non-deterministic method.

15. A system for managing immutable objects, the system comprising:

memory for storing an application server and a virtual machine;

one or more processors coupled to the memory for executing the application server and the virtual machine; and

a persistent storage system;

wherein the virtual machine:

monitors new object construction;

detects construction of an object;

determines a key for the object;

looks the key up in the persistent storage system;

when the key is found in the persistent storage system, loads the object from the persistent storage system; and

when the key is not found in the persistent storage system:

constructs the object;

determines whether the object is immutable; and

stores the object in the persistent storage system when the object is immutable;

wherein to determine whether the object is immutable, the virtual machine:

examines each primitive type data member of the object;

examines each reference type constructor parameter of the object to determine whether the reference type constructor parameter is defensively copied;

examines all function calls used by the object to determine whether the function calls preserve immutability; and

recursively examines each reference type data member of the object.

16. The system of claim 15 wherein the virtual machine is an extended Java virtual machine.

17. The system of claim 15 wherein the persistent storage system comprises a database.

18. The system of claim 15 wherein the persistent storage system stores one or more key-value pairs wherein a value in each key-value pair corresponds to an immutable object identified by a corresponding key in the key-value pair.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 21, 2013
From: ELIAS, FILIP; NGUYEN, FILIP
To: RED HAT, INC.
Reel/Frame 030460/0682 →
Continuity (1)
Related Publication 20140351789A1 · Nov 27, 2014