We can no longer use the Runnable interface to do this. We must use the callable interface that was implemented … More
Tag: threads
[Java] – How to work with Thread Factory ? Understanding how to treat thread exceptions.
What is ThreadFactory? It is where we create each thread that will be used in our thread pool. The factory … More
[Java] – Understanding Volatile and a little more about Threads
So imagine the following situation: Two threads with the same implementation running and you want both stop running if one … More
[Java] – How to check how many processors have available?
Below is the code for you check it : public class QtyProcessorsTest { public static void main(String[] args) { Runtime runtime = … More
[Java8] – Threads with lambdas
Example: @Test public void myMethod(){ Runnable run = () -> {System.out.println(“Execute Runnable”);}; new Thread(run).start(); } Console :