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

Small optimization for java.vm.Thread that avoids unnecessary locking and table lookups.