Java Lock

preview_player
Показать описание
The Java Lock interface represents a concurrent lock which can make sure only one thread at a time can lock the lock, perform its critical logic atomically, and unlock the lock again. A Java Lock is similar to a Java Synchronized block, but is more flexible and has more features.

A Java Lock can be reentrant, meaning the same thread can lock the Lock more than one time. The Lock must then be unlocked the same number of times before it is fully unlocked for other threads.

Chapters:
0:00 Java Lock and ReentrantLock introduction
2:02 Two concurrent Counter class examples
3:38 Lock and unlock the Lock inside a try-finally clause
5:00 Lock reentrance
7:03 Lock reentrance use case
10:24 Lock fairness
14:40 Lock examples
24:04 ReentrantLock methods
26:07 Java Lock vs. synchronized blocks - differences and similarities.

Java Lock Tutorial - text:

Java Synchronized Blocks - text / video:

Reentrance Lockout - text:

Starvation and Fairness - text:

Java Concurrency tutorial - text / video playlist:
Рекомендации по теме
Комментарии
Автор

this whole java concurrency series is priceless. Thank you for the great pacing, examples and time spent to record it!

kristiyangerasimov
Автор

Jakob my beloved, I cannot ever thank you enough. The Java community is a better place with teachers like you in it, thank you!!

itsahandle
Автор

I'm insanely grateful for this series, you explain everything in the best way possible!

jober
Автор

God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading qns...Thanks a Lot form 10+ yrs exp guy from BLR, India.

shubhamagarwal
Автор

Drinking game: Every time Jakob says "lock", take a shot

sreekaransrinath
Автор

This is the best tutorial ever. Thank you for doing this!

raj_kundalia
Автор

This the level of explanation that looked for!
Great videos!

CAMOBAP
Автор

Probably the best tutorial about the Lock interface. also, I can feel semantic satiation happening for you because of the word "lock". 😁

amiralitavakoli
Автор

Hi, Jakob. Your videos are really useful to me and thanks a lot. Please continue!

hero_xiper
Автор

13:25 now I know what "starvation" means in multithreading context.

ffatheranderson
Автор

Hello Jakob, I just found your channel today while searching for Java multi-threading tutorials. Your videos are the best ones that I have come across.
I just realized that this video was posted today while I was watching your playlist on multi-threading. Timely post I guess :D.
Are you going to post more videos on this topic?

vdiitd
Автор

keep up the great work, you deserve to have millions of subs and views 💯

kamelwerghi
Автор

Thanks again for the great detailed videos! :D The best video I could find for multithreading and concurrency.
One suggestion is to also explain example use case of lockInterruptible.

smitmandavia
Автор

Hi Jakob, great content as usual but i am adding a small suggestion that you should've explained about other implementations of Lock interface and how many locks are there in java etc.

ManishKumar-qxkh
Автор

I watched various videos but this one was the best. Thanx for such great video. And keep spreading knowledge😁....

rahulgupta
Автор

Hi Jakob. Your blog and videos are always helpful to me, in getting my job and performing well in it. Have you got a patreon or is there a way I can buy you a coffee? Keep up the great work

bocumasix
Автор

Thank you Jakob for this awesome video that enlightened the topic for me!

utkuceylan
Автор

Brother your content is really top notch, keep doing the good work. Thanks 👍🏻

technophylic
Автор

Hi Jakob, Thnx for such a great tutorial. I wonder How do you create the diagrams which you use during the lectures?

leetcodeproblems
Автор

22:23 good explanation on use case for try lock.

ffatheranderson