[java] do not require a lock and hash lookup for calling Thread.current() from the main thread
Merge pull request #2118 from jonasmalacofilho/development

[java] do not require a lock and a lookup for calling Thread.current from the main thread