Prior to reading this paper, I had no significant understanding of the term 'reentrant'. The idea is a program can be reentrant is distinct executions of that program on distinct inputs cannot affect each other. Many existing Java programs are not reentrant because they rely on mutable global state.
The developers implemented the refactoring for reentrancy in a tool called Reentrancer as an extension to the the Eclipse Java development tools (JDT). The refactoring for making programs reentrant are:
- Removal of non-reentrant accesses to library global state.
- Encapsulation of static fields in the application in getter/setter methods.
- Replacing static initializers with explicit lazy initialization.
- Replacing global state with thread-local state.
- Transforming the application to use a fresh thread for each execution.
Knowing 2 of the 3 authors of this paper are from IBM, I can understand why the Reentrancer plugin is only available for Eclipse. What about programmers or development teams who do not use Eclipse? There are many hooks in place for plugins developed for the Eclipse IDE, but many non-conformers are missing out on the potential benefits of using a refactoring mechanism like Reentrancer. I do hope there is a way to apply automatic refactorings to code without having to use Eclipse all the time.
No comments:
Post a Comment