Concurrent Collections
Besides managing threads, Concurrency API includes interfaces and classes that help to coordinate access to collections across multiple tasks. Using concurrent collections is extremely convenient in …
Protecting Data with Atomic Classes
With the release of Concurrency API Java added a new java.util.concurrent.atomic package to help coordinate access to primitive values and object references. As with most classes …
Increasing Concurrency with Pools
Executors class has factory methods that act on a pool of threads, rather than on a single thread. A thread pool is a group of pre-instantiated …
Scheduling tasks using Concurrency API
Oftentimes in Java, there is a need to schedule a task to happen at some future time. Sometimes tasks must be scheduled to happen repeatedly, at …
java.util.concurrent.Callable interface
Callable interface is similar to Runnable except that its call() method returns a value and can throw a checked exception, while run() method of Runnable interface …
Submitting Tasks to ExecutorService
Tasks to an ExecutorService can be submitted in multiple ways. execute() method is inherited from the Executor interface, which ExecutorService interface extends. The execute() method takes …
Shutting Down a Thread Executor
One using a thread executor is finished, it is important to call the shutdown() method on an instance of an ExecutorService interface. A thread executor creates …
Intercepting Filter Pattern
Intercepting Filter Pattern is used when developer wants to do some pre-processing with request or response of the application. Filters are defined and applied on the …
Transfer Object Pattern
Transfer Object Pattern is used when developer wants to pass data with multiple attributes in one shot from client to server. Transfer Object is also known …
Front Controller Pattern
Front Controller design pattern is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler. This handler …