SPRING CORE / NOTES</>↗Spring Core05 Nov 2012
Using Spring Expression Language (SpEL) we can inject object references or values into a bean dynamically when the bean is created instead of statically defined at development time. In this example you’ll learn how to inject a bean’s property using a property of another bean. Let start by create two classes, the Student and Grade […]
CONCURRENCY / NOTES</>↗Concurrency19 Sep 2012
In the following code snippet you will learn how to use the LinkedBlockingQueue class. This class implements the BlockingQueue interface. We can create a bounded queue by specifying the queue capacity at the object construction. If we do not define the capacity, the upper bound is limited to the size of Integer.MAX_VALUE. The data in […]
CONCURRENCY / NOTES</>↗Concurrency15 Sep 2012
The java.util.concurrent.DelayQueue class in an implementation of the BlockingQueue interface. Elements added to the queue must implement the java.util.concurrent.Delayed interface. The queue is unbound in size, enabling adds to return immediately, we can only take an element from the queue when the delay time has expired. If multiple elements have expired delays, the element with […]
CONCURRENCY / NOTES</>↗Concurrency12 Sep 2012
In this example you’ll learn how to close or shutdown a BlockingQueue when no more element available in the queue. We will use the common strategy by making the Producer to send a marker object in a Producer – Consumer scenario. This marker object also known as the poison object will be considered as a […]
CONCURRENCY / NOTES</>↗Concurrency12 Sep 2012
ArrayBlockingQueue is one implementation of the java.util.concurrent.BlockingQueue which internally store the queue elements inside an array. The ArrayBlockingQueue can store elements for the size defined when the object is initialized, by the constructor. Once it size is defined it cannot be change or resize. The code snippet below demonstrate the ArrayBlockingQueue class. We initialize the […]
CONCURRENCY / NOTES</>↗Concurrency11 Sep 2012
A java.util.concurrent.BlockingQueue is an interface that extends the java.util.Queue that add special support for blocking operations. It will wait or block for the queue to become available when retrieving element operations occurs and wait or block the storing element operations until the queue has space available. There are some implementations available for the java.util.concurrent.BlockingQueue interface. […]