Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-dd-dev] DSF Executor & Runnable

Hi Aydin,
The DSF executor does process the runnables sequentially _except_ when a runnable is scheduled to run with a delay. In this case other runnables will be executed until the time is reached to run the delayed one. The serviceQueue() method calls the process*Request() methods inside a runnable, which is scheduled to execute with a delay. The fServiceQueueInProgress flag is then used to make sure that only one of these runnables is scheduled at a time. Cheers,

Serhat Aydın wrote:
In DSF documentation it says : *For DSF, the main rule for executors is that they have to use a single thread to execute the runnable and that the runnables be executed in the order that they were submitted.

*So if  runnables are executed in the order that they were submitted;
in "DataGeneratorWithExecutor" sample, why *if (fServiceQueueInProgress)* control is used ? I understood that DsfRunnables will be executed orderly and there will be only one active serviceQueue function. And there will be always one request in the queue ?

public void getCount(final DataRequestMonitor<Integer> rm) {
   try {
       fExecutor.execute( new DsfRunnable() {
           public void run() {
               fQueue.add(new CountRequest(rm));
   } catch (RejectedExecutionException e) {
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));

private void serviceQueue() {
         // If a queue servicing is already scheduled, do nothing.
   if (fServiceQueueInProgress) {
         if (fQueue.size() != 0) {
       // If there are requests to service, remove one from the queue and
       // schedule a runnable to process the request after a processing
       // delay.
       fServiceQueueInProgress = true;
       final Request request = fQueue.remove(0);
           new DsfRunnable() {
               public void run() {
                   if (request instanceof CountRequest) {
                   } else if (request instanceof ItemRequest) {
// Reset the processing flag and process next
                   // request.
                   fServiceQueueInProgress = false;
dsdp-dd-dev mailing list

Back to the top