Avoid deadlock on close (JAVA-418).
Merge branch '2.0' into 2.1