Handling concurrent access to shared resources in Java | Sebastian Konieczek (EN)
Multithreaded applications are to be found everywhere. Think of RESTful micro services for example. The very nature of a classic Webserver is Multithreading as every Request is processed concurrently by an available worker thread.
This means a lot of concurrent access to shared resources. And with Java’s virtual threads, there will be even more concurrency.
Most of the time we rely on Frameworks and Tools to handle concurrent access correctly.
But there are times when we need to handle this ourselves and this is where the trouble starts.
Think of concurrent writes or updates to a shared file in the files system.
Another example may be, having a shared state in memory that is mutated concurrently or the use of stateful singletons.
In software development, controlling access to shared resources is often solved with mutexes or semaphores.
But limiting resource access has certain drawbacks to consider.
In this session you will learn what kind of mutex or locking strategies exist and when to choose which.
I will give a brief introduction to the techniques Java has to offer and what the locking strategy behind each approach is.
You will learn, what to consider when using mutexes in virtual threads.
In the end you will know how to choose the fitting key for your lock and get the best performance whilst preserving data integrity.
➜ Abonniere JAVAPRO und verpasse keine News:
https://bit.ly/YouTube-JAVAPRO-abonnieren
▬ Über uns: ▬
JAVAPRO ist das Magazin für professionelle Java-Entwicklung in der Praxis.
Über das Magazin hinaus ist JAVAPRO Veranstalter der jährlich stattfindenden Entwickler-Konferenz JCON. Auf der JCON stehen Core Java, Enterprise Java, Microservices, APIs und Frameworks im Fokus.
Auf diesem Kanal finden sich Interviews, Sessions, Tipps & Tricks und alles, was das (Java)-Entwickler-Herz begehrt.
➜ Jetzt kostenlos Magazin anfordern:
https://javapro.io
▬ Folge uns auf Social Media: ▬
Twitter: https://twitter.com/JAVAPROmagazin
LinkedIn: https://www.linkedin.com/company/75505519
➜ Danke fürs Abo & fürs Zusehen!