SPRING CORE / CATATAN</>↗Spring Core05 Nov 2012
In this example you will learn how to avoid a null value, which causing a NullPointerException thrown in a Spring EL expression. To avoid this from happening we can use the null-safe accessor, using the ?. operator. We are using the previous example, How do I inject bean’s property using Spring EL? classes, which are […]
CONCURRENCY / CATATAN</>↗Concurrency05 Nov 2012
This example demonstrate how to use the PriorityBlockingQueue class. The PriorityBlockingQueue is one implementation of the BlockingQueue interface. It is an unbounded concurrent queue. The object place in this type of queue must implement the java.lang.Comparable interface. The Comparable interface defines how the order priority of the elements inside this queue. For simplicity, in this […]
SPRING CORE / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 […]