An Automated Refactoring Approach to Improve IoT Software Quality
Abstract
:1. Introduction
- We developed algorithms that could convert built-in monitor locks to fine-grained ReentrantReadWriteLocks.
- We developed an automated refactoring tool implemented as Eclipse plugins.
- We evaluated our tool on several real-world applications.
2. Related Work
3. Motivation
3.1. Background
3.2. Motivating Example
3.3. Performance Evaluation
4. Refactoring for Fine-Grained ReentrantReadWriteLocks
4.1. Refactoring Framework
4.2. Visitor Pattern Analysis
- For synchronized instance methods, the monitor object is this;
- For a synchronized block with an instance monitor object o, the monitor object is o;
- For synchronized static methods, the monitor object is a class object;
- For a synchronized block with a static monitor object O, the monitor object is O;
4.3. Lock Mode
4.4. Alias Analysis
4.5. Side Effect Analysis
5. Refactoring Tool and Practical Issues
5.1. Refactoring Tool
5.2. Practical Issues
6. Evaluation
6.1. Setup
6.2. Benchmarks
6.3. Results
6.4. Correctness Of Refactoring
6.5. Comparison With Relocker
7. Conclusions and Future Work
Author Contributions
Funding
Acknowledgments
Conflicts of Interest
References
- Shen, M.; Ma, B.; Zhu, L.; Mijumbi, R.; Du, X.; Hu, J. Cloud-based approximate constrained shortest distance queries over encrypted graphs with privacy protection. IEEE Trans. Infor. Forensics Secur. 2017, 13, 940–953. [Google Scholar] [CrossRef] [Green Version]
- Xiao, L.; Li, Y.; Huang, X.; Du, X. Cloud-based Malware Detection Game for Mobile Devices with Offloading. IEEE Trans. Mob. Comput. 2017, 16, 2742–2750. [Google Scholar] [CrossRef]
- Hassan, W.H. Current research on Internet of Things (IoT) security: A survey. Comput. Netw. 2019, 148, 283–294. [Google Scholar]
- Tian, Z.; Luo, C.; Qiu, J.; Du, X.; Guizani, M. A distributed deep learning system for Web attack detection on edge devices. IEEE Trans. Ind. Inform. 2019. [Google Scholar] [CrossRef]
- Tian, Z.; Su, S.; Shi, W.; Du, X.; Guizani, M.; Yu, X. A data-driven method for future Internet route decision modeling. Future Gener. Comput. Syst. 2019, 95, 212–220. [Google Scholar] [CrossRef]
- Qiu, J.; Chai, Y.; Tian, Z.; Du, X.; Guizani, M. Automatic Concept Extraction based on Semantic Graphs from Big Data in Smart City. IEEE Trans. Comput. Soc. Syst. 2019. [Google Scholar] [CrossRef]
- Qiu, J.; Du, L.; Zhang, D.; Su, S.; Tian, Z. Nei-TTE: Intelligent Traffic Time Estimation Based on Fine-grained Time Derivation of Road Segments for Smart City. IEEE Trans. Ind. Inform. 2019. [Google Scholar] [CrossRef]
- Tan, Q.; Gao, Y.; Shi, J.; Wang, X.; Fang, B.; Tian, Z. Toward a Comprehensive Insight Into the Eclipse Attacks of Tor Hidden Services. IEEE Internet Things J. 2019, 6, 1584–1593. [Google Scholar] [CrossRef]
- Aldrich, J.; Chambers, C.; Sirer, E.; Eggers, S. Static analyses for eliminating unnecessary synchronization from Java programs. Int. Static Anal. Symp. 1999, 1694, 19–38. [Google Scholar]
- Bogda, J.; Hölzle, U. Removing unnecessary synchronization in Java. ACM Sigplan Not. 1999, 34, 35–46. [Google Scholar] [CrossRef] [Green Version]
- Tao, B.; Qian, J. Refactoring java concurrent programs based on synchronization requirement analysis. IEEE Int. Conf. Softw. Maint. Evol. 2014, 361–370. [Google Scholar]
- Lea, D. Concurrent Programming in Java: Design Principles and Patterns; Addison-Wesley Professional: Boston, MA, USA, 2000. [Google Scholar]
- Diniz, P.C.; Rinard, M.C. Lock coarsening: Eliminating lock overhead in automatically parallelized object-based programs. J. Parallel Distrib. Comput. 1998, 49, 218–244. [Google Scholar] [CrossRef]
- Schafer, M.; Sridharan, M.; Dolby, J.; Tip, F. Refactoring Java programs for flexible locking. In Proceedings of the 2011 33rd International Conference on Software Engineering (ICSE), Honolulu, HI, USA, 21–28 May 2011; pp. 71–80. [Google Scholar]
- Zhang, Y.; Dong, S.; Zhang, X.; Liu, H.; Zhang, D. Automated Refactoring for StampedLock. IEEE Access 2019, 7, 104900–104911. [Google Scholar] [CrossRef]
- Bavarsad, A.G.; Atoofian, E. Read-Write Lock Allocation in Software Transactional Memory. In Proceedings of the 2013 42nd International Conference on Parallel Processing, Lyon, France, 1–4 October 2013; pp. 680–687. [Google Scholar]
- Emmi, M.; Fischer, J.S.; Jhala, R.; Majumdar, R. Lock allocation. ACM Sigplan Not. 2007, 42, 291–296. [Google Scholar] [CrossRef]
- Kawachiya, K.; Koseki, A.; Onodera, T. Lock reservation: Java locks can mostly do without atomic operations. ACM Sigplan Not. 2002, 37, 130–141. [Google Scholar] [CrossRef]
- Hofer, P.; Gnedt, D.; Schörgenhumer, A.; Mössenböck, H. Efficient tracing and versatile analysis of lock contention in Java applications on the virtual machine level. In Proceedings of the 7th ACM/SPEC on International Conference on Performance Engineering, Delft, The Netherlands, 12–16 March 2016; pp. 263–274. [Google Scholar]
- Zhang, Y.; Shao, S.; Liu, H.; Qiu, J.; Zhang, D.; Zhang, G. Refactoring Java Programs for Customizable Locks Based on Bytecode Transformation. IEEE Access 2019, 7, 66292–66303. [Google Scholar] [CrossRef]
- Dig, D.; Marrero, J.; Ernst, M.D. Refactoring sequential Java code for concurrency via concurrent libraries. In Proceedings of the 31st International Conference on Software Engineering, Vancouver, BC, Canada, 16–24 May 2009; pp. 397–407. [Google Scholar]
- Wloka, J.; Sridharan, M.; Tip, F. Refactoring for Reentrancy. In Proceedings of the the 7th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The foundations of Software Engineering, Amsterdam, The Netherlands, 24–28 August 2009; pp. 173–182. [Google Scholar]
- Du, X.; Guizani, M.; Xiao, Y.; Chen, H.H. Transactions papers a routing-driven elliptic curve cryptography based key management scheme for heterogeneous sensor networks. IEEE Trans. Wirel. Commun. 2009, 8, 1223–1229. [Google Scholar] [CrossRef]
- Dong, P.; Du, X.; Zhang, H.; Xu, T. A detection method for a novel DDoS attack against SDN controllers by vast new low-traffic flows. In Proceedings of the 2016 IEEE International Conference on Communications (ICC), Kuala Lumpur, Malaysia, 22–27 May 2016; pp. 1–6. [Google Scholar]
- Tian, Z.; Shi, W.; Wang, Y.; Zhu, C.; Du, X.; Su, S.; Sun, Y.; Guizani, M. Real-Time Lateral Movement Detection Based on Evidence Reasoning Network for Edge Computing Environment. IEEE Trans. Ind. Inform. 2019, 15, 4285–4294. [Google Scholar] [CrossRef] [Green Version]
- Qiu, J.; Chai, Y.; Tian, Z.; Du, X.; Guizani, M. Vcash: A Novel Reputation Framework for Identifying Denial of Traffic Service in Internet of Connected Vehicles. IEEE Internet Things J. 2020. [Google Scholar] [CrossRef] [Green Version]
- Xiao, L.; Wan, X.; Dai, C.; Du, X.; Chen, X.; Guizani, M. Security in mobile edge caching with reinforcement learning. IEEE Wirel. Commun. 2018, 25, 116–122. [Google Scholar] [CrossRef]
- Wu, L.; Du, X.; Wang, W.; Lin, B. An Out-of-band Authentication Scheme for Internet of Things Using Blockchain Technology. In Proceedings of the 2018 International Conference on Computing, Networking and Communications (ICNC), Maui, HI, USA, 5–8 March 2018; pp. 769–773. [Google Scholar]
- Oracle. Java.util.concurrent.locks.ReentrantReadWriteLock API Specification. Available online: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html (accessed on 5 December 2019).
- Oracle. Java.util.concurrent.locks API Specification. Available online: http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/package-summary.html (accessed on 12 August 2019).
- Pinto, G.; Torres, W.; Fernandes, B.; Castor, F.; Barros, R.S. A large-scale study on the usage of Java’s concurrent programming constructs. J. Syst. Softw. 2015, 106, 59–81. [Google Scholar] [CrossRef]
- WALA. Available online: http://wala.sourceforge.net/wiki/index.php/Main_Page (accessed on 12 August 2019).
- Eclipse JDT. Org.eclipse.jdt.core.dom.ASTParser API Specification. Available online: https://help.eclipse.org/kepler/ntopic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/dom/ASTParser.html (accessed on 6 December 2019).
- HyperSQL. Available online: http://hsqldb.org/ (accessed on 6 December 2019).
- Cassandra. Available online: https://cassandra.apache.org/ (accessed on 6 December 2019).
- JGroups. Available online: http://www.jgroups.org/ (accessed on 6 December 2019).
- Freedomotic. Available online: https://freedomotic-user-manual.readthedocs.io/en/latest/index.html (accessed on 6 December 2019).
- MINA. Available online: http://mina.apache.org/mina-project/ (accessed on 6 December 2019).
Regulation | Sequence |
---|---|
Regulation 1 | |
Regulation 2 | |
Regulation 3 | |
Regulation 4 | |
Regulation 5 |
Benchmark | KSLOC | #Built-In Monitors | #Downgrading Locks | #Splitting Locks | #Read Locks | #Write Locks |
---|---|---|---|---|---|---|
HSQLDB | 179 | 621 | 6 | 39 | 51 | 525 |
Cassandra | 432 | 239 | 2 | 24 | 33 | 180 |
JGroups | 123 | 179 | 5 | 33 | 28 | 113 |
Freedomotic | 57 | 21 | 2 | 1 | 2 | 16 |
MINA | 24 | 12 | 0 | 3 | 1 | 8 |
Relocker | Our Tool | ||||||
---|---|---|---|---|---|---|---|
Benchmark | #Read Locks | #Write Locks | #Can’t Be Refactoring | #Downgrading Locks | #Splitting Locks | #Read Locks | #Write Locks |
HSQLDB | 31 | 212 | 23 | 8 | 23 | 45 | 190 |
Cassandra | 4 | 50 | 3 | 3 | 1 | 6 | 47 |
© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhang, Y.; Shao, S.; Ji, M.; Qiu, J.; Tian, Z.; Du, X.; Guizani, M. An Automated Refactoring Approach to Improve IoT Software Quality. Appl. Sci. 2020, 10, 413. https://doi.org/10.3390/app10010413
Zhang Y, Shao S, Ji M, Qiu J, Tian Z, Du X, Guizani M. An Automated Refactoring Approach to Improve IoT Software Quality. Applied Sciences. 2020; 10(1):413. https://doi.org/10.3390/app10010413
Chicago/Turabian StyleZhang, Yang, Shuai Shao, Minghan Ji, Jing Qiu, Zhihong Tian, Xiaojiang Du, and Mohsen Guizani. 2020. "An Automated Refactoring Approach to Improve IoT Software Quality" Applied Sciences 10, no. 1: 413. https://doi.org/10.3390/app10010413
APA StyleZhang, Y., Shao, S., Ji, M., Qiu, J., Tian, Z., Du, X., & Guizani, M. (2020). An Automated Refactoring Approach to Improve IoT Software Quality. Applied Sciences, 10(1), 413. https://doi.org/10.3390/app10010413