Static Block in Java

Static block in Java is used to initialize the static variables (also known as class variables). To initialize instance variables there are constructors, where error handling or other logic can be used. To provide the same capability for class variables, there are static initialization blocks in Java. Syntax of Java…

Continue reading

Java ScheduledThreadPoolExecutor – Scheduling With ExecutorService

ScheduledThreadPoolExecutor in Java adds functionality to schedule commands to run after a given delay, or to execute periodically. Since ScheduledThreadPoolExecutor is an ExecutorService so it uses thread from a thread pool to execute tasks. Java ScheduledThreadPoolExecutor ScheduledThreadPoolExecutor class is part of Java Executor framework with in the Java concurrent API.…

Continue reading

Java Executor Tutorial – Executor, ExecutorService, ScheduledExecutorService

In this Java executor tutorial we’ll learn how to use Executor, ExecutorService, ScheduledExecutorService and their thread pool implementations to effectively manage threads in a large scale application. Java Executor API While using Java multi-threading for creating thread, there is a close connection between the task being done by a new…

Continue reading