Yo dawg, I heard you liked concurrency primitives. Let’s implement our own asynchronous, dirty CountDownLatch.| Alexandru Nedelcu - Blog
OOP couples the data with the methods operating on it, and this is considered bad in FP circles. But is it?| Alexandru Nedelcu - Blog
Some time ago, while profiling our game, I noticed that we have a lot of thread locking and contention resulting from a single mutexed MPMC job queue processing a large amount of tiny jobs. It wasn’t possible to merge work … Continue reading →| Krzysztof Narkowicz
We will look into the concepts of Virtual threads that are provided as a preview feature in JDK 19| RefactorFirst
Why wait(), notify() and notifyAll() methods have been defined in the Object class?Java concurrency model uses locks to implement mutually exclusive access to objects in a multi-threaded environment and locks are associated with every object in Java (of type 'Object'), not only with Threads.wait, notify/notifyAll methods are used by threads to communicate with each other while trying to access a| Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!
Usage of ThreadLocal: per-thread Singleton and per-thread LoggingShould you require a refresh of what ThreadLocals in Java are and how they work, refer to this article first. You can then proceed with the current article for understanding two of the most common uses of ThreadLocals in Java.per-thread Singleton impl using ThreadLocalSuppose you have a need of having a JDBC Connection objects per| Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!
ThreadLocal in Java - what is it used for?As the name suggests this Java library class is used for supporting thread-local variables - the variables which are local to the particular thread instance and hence each thread will have their own copy of such variables which will be initialized every time a new thread is spawned.To be more clear, let's take one simple example. If you have a class| Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!