Posts

Showing posts with the label multi

Eclipse command framework core expression : Multiple handlers

Image
Eclipse platform command framework supports core expression to control commands behavior runtime. In this series of posts I have explained different ways of using core expressions . This post explains having multiple handler for same command but activate only one of it at runtime based on some of the condition. Eclipse command framework is based on MVC framework. Command declaration, handler declaration  and contributing command to workbench helps to keep declaration separate from presentation. You can have multiple handlers for same command, but only one will be active at one moment. Core expression provides “activeWhen” declarative clause to activate specific handler for given command based on specific condition. Here is how we use it . I have created a new eclipse plug-in project. I have extended “org.eclipse.ui.editors” extension point to define two simple text editors. Here I am going to define two different handlers for same commands but only one will be active based on e...

Synchronized Queue

Till Java 5 (jdk1.5) developer has to take care of synchronizing queue in multi threaded application. But in Java5 new synchronized implementation java.util.concurrent.BlockingQueue has been introduced. It extends java.util.Queue and introduced few new methods like put, take etc. BlockingQueue supports additional operations that waits for the queue to become non-empty when retrieving an element from queue, and wait for space to become available in the queue when storing an element. There are following few implementation available ArrayBlockingQueue : A simple bounded BloickingQueue implementation backed by an array. DelayQueue : An unbounded blocking queue of Delayed elements, in which an element can only be taken when its delay has expired.It uses elements that implement the new java.util.concurrent.Delayed interface. PriorityBlockingQueue : This queue bases ordering on a specified Comparator , and the element returned by any take( ) call is the smallest element based on t...