A method to enabling interoperability of a locking synchronization method
with a lock-free synchronization method in a multi-threaded environment
is presented. The method examines a class file for mutable fields
contained in critical code sections. The mutable fields are transferred
to a shadow record and a pointer is substituted in the class field for
each transferred mutable field. Code is altered so that the lock-free
synchronization method is used if a lock is not held on the object.
Atomic compare and swap operations are employed after mutable fields are
updated during execution of the lock-free synchronization method.