Automated Refactoring for Stampedlock
Open Access
- 30 July 2019
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Access
- Vol. 7, 104900-104911
Abstract
StampedLock, proposed in JDK 1.8, provides many interesting features, such as optimistic read locks and upgrading/downgrading locks to improve the design of concurrent programs instead of employing pure read/write locks. Existing refactorings have proposed algorithms to convert locks, but there are a few refactorings that use these promising features of StampedLock. To illustrate a possible refactoring, this paper first shows three code transformations based on StampedLock. Then, this paper presents CLOCK, an automated refactoring tool that helps developers convert the synchronized lock into the StampedLock. An algorithm for reentrance analysis is proposed for the precondition validation. The write lock, read lock, optimistic read lock, and upgrading/downgrading lock are inferred and refactored. CLOCK is evaluated with the SPECjbb2005 benchmark and two real-world applications, Xalan and FOP. A total of 66 classes are modified by searching approximately 395KSLOC and applying the refactoring, achieving an average of 22 classes per benchmark. The experimental results show that CLOCK can help developers with refactoring for StampedLock and save developer effort.Keywords
Funding Information
- National Natural Science Foundation of China (61440012)
- Scientific Research Foundation of Hebei Educational Department (ZD2019093)
- Fundamental Research Foundation of Hebei Province (18960106D)
This publication has 13 references indexed in Scilit:
- Preemptive Software Transactional Memory2017
- Refactoring Java Concurrent Programs Based on Synchronization Requirement Analysis2014
- Crossing the gap from imperative to functional programming through refactoring2013
- Refactoring Java programs using concurrent libraries2011
- Refactoring Java programs for flexible locking2011
- A scalable lock-free stack algorithmJournal of Parallel and Distributed Computing, 2010
- Refactoring for reentrancy2009
- FlexSync: An aspect-oriented approach to Java synchronization2009
- Autolocker2006
- SyncGen: An Aspect-Oriented Framework for SynchronizationLecture Notes in Computer Science, 2004