Tag: concurrency

  • Java 21 – Scoped Values

    How do you pass a value from one part of your code to another. Let’s say from one class to another. By using method arguments. Is there any other way that you can access a shared variable? For example, Let’s say you need to pass the user name who logged into your web app from…

  • Java 21 – Virtual Threads

    Java supports concurrency. You can perform multiple tasks at the same time in a program. And how does Java implement this? Using Threads! A thread is the basic unit of concurrency in Java. If you want to perform multiple tasks in parallel you create one thread for each task and perform them in parallel. And…

  • How to implement Concurrency in Java – A very minimalist example

    Let’s say you are implementing a batch service and you want to execute a lot of methods. Let’s assume they are independent functionalities and the output of one is not used by any other methods. Executing them one by one will consume a lot of time. The best strategy is to execute them in parallel.…