Journal of Hebei University of Science and Technology (Oct 2021)

An automated refactoring approach for asynchronous mechanism

  • Minghan JI,
  • Lin QI,
  • Yang ZHANG,
  • Shicheng DONG,
  • Chaoshuai LI

DOI
https://doi.org/10.7535/hbkd.2021yx05008
Journal volume & issue
Vol. 42, no. 5
pp. 499 – 507

Abstract

Read online

As synchronous blocking wastes system resources and affects program performance in concurrent processing,an automatic refactoring approach based on the asynchronous mechanism of CompletableFuture was proposed.Firstly,several static analyses by Wala static program analysis tool,such as visitor pattern analysis,alias analysis,and data flow analysis were used in this approach,so that the operation mode of shared variable data was determined.Then four asynchronous refactoring modes were set based on the asynchronous mechanism of CompletableFuture.Finally,the code was refactored according to different modes.An automatic tool AsynRef was implemented by Eclipse and four large-scale practical applications such as HSQLDB,Jenkins,JGroups,and SPECjbb2005 were automatically refactored by AsynRef.AsynRef was evaluated via the number of refactored locks,changed lines of code,accuracy,program performance after refactoring.Among the 919 synchronous methods contained in the four programs,387 asynchronous mechanism conversions were completed.After Asynref was used for asynchronous mechanism refactoring,the program execution performance was improved by 8% to 39%.AsynRef can refactor for aynchronized mechanism effectively.Compared to manual refactoring,the refactoring efficiency is improved significantly.[HQ]

Keywords