Quantcast
Channel: Scratch Where It's Itching
Viewing all articles
Browse latest Browse all 73

Autoclose Lock

$
0
0
I was just wondering if there is a difference between the classic:
	lock.lock();try { //I have the lock!
	}  finally {
		lock.unlock();
	} 

And the Autocloseable version:

	lock.lock();try (AutoCloseable auto = lock::unlock) { //I have the lock!
	} 


Viewing all articles
Browse latest Browse all 73

Trending Articles