Java Lock.tryLock() is a method in the Java Lock interface that attempts to acquire the lock without blocking. If the lock is available, it is immediately acquired; if not, it returns false. Introduced in Java 2004 with Java 5, tryLock() is useful in concurrent programming when a thread does not want to block indefinitely if it cannot acquire the lock.
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html