A Join Point for Synchronized Block in AspectJ
Chenchen Xi, Bruno Harbulot, John R. Gurd · 2008
Synchronization is a key software concern that could be advised not only for synchronization in a multi-threaded program but also for treating the distributed environment as the crosscutting concern. However, the synchronized block in Java has not yet been treated in AspectJ or in any other Aspect-Oriented Programmingframework. This paper develops a synchronized block join point model which allows AspectJ to interact directly with synchronization actions. The approach for recognising the synchronized block uses context exposure to provide full control of the thread behaviour when many threads compete to be executed. The proposed join point model is enhanced with a mechanism for removal of unnecessary synchronization, which is vital for reducing overheads associated with the lock. Further, the model could also be used to turn lock based synchronization actions into atomic transactions with software transactio nal memory. SynAJ, the extensions for the abc compiler that provide AspectJ with a synchronized block join is presented and shown to meet the requirement of different applications.