Automated refactoring for Java concurrency