In one of the past videos, we looked at locks in the Java language, how and when to use them - • Synchronized vs ReadWriteLock vs Stam... .
In this video, we will change a little the task from the last video to get familiar with the ScheduledExecutorService, AtomicRefrerence and the Either monad!
Happy viewing!
Timecodes:
00:00 - In this issue
00:27 - AtomicReference, ExecutorService and Either. What will this video be about?
01:18 - Goals and objectives.
01:41 - Statement of a practical problem to be solved.
02:55 - volatile field for solving the problem.
03:42 - Implementation of the getToken method for a volatile field.
04:55 - Problem handling errors from another thread and using the Either monad.
06:26 - The thread that will generate tokens is ScheduledExecutorService. Demon flows. AtomicInteger.
08:41 - Implementation of the token generation method.
10:45 - How exactly tokens will be generated / updated.
11:20 - Implementation of the invalidateToken method.
12:49 - Change the volatile field to AtomicReference. Why and how?
14:45 - How to generate a new token if it was deleted via invalidate. ScheduledFuture and cancel method.
19:42 - How to test written code? Examples of tests.
25:50 - Benchmark for our implementation. What does it show and is it needed at all?
26:28 - Conclusions
19:00 - See you in the next videos, but for now, like and subscribe
Code from video - https://github.com/LutherWest/java-co...
____
Subscribe to our social networks:
Instagram: / mjc.talks
MJC Telegram Chat: https://t.me/mjcby
Community page: https://mjc.by
Watch video Java Multithreading: AtomicReference, ScheduledExecutorService, and the Either monad. Multithreadin online without registration, duration hours minute second in high quality. This video was added by user MJC 09 September 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,355 once and liked it 133 people.