• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

how to implement "buffering"

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,

I have a little problem of implementation of a buffer in my project. There is a distributed system, where there are a Boss and a fixed number of Servants.
Servants have to do tasks(implemented by the "sleep" function).
The Boss has to send a "CHECKPOINT"request to the Servants. After Servants has received that message from the Boss, they have to memorize their own state (the number of tasks) in stable storage. While doing that, no message has to be send. So if a Servant gets a CHeCKPOINT message from the Boss, then it has to buffer the task(s) it was doing, and save its own state in memory.

Now the question is: how can I implement the buffer?

At the moment, every servant has an input LinkedList for the incoming messages, and an output LinkedList for the outgoing messages. When it has to do a task, the servants read the first taask to do from the incoming linkedList. So if it is doing task and in the meanwhile a CHECKpoint-request comes, it has to be able to buffer the task and reply to the CHECKPOINT REQUEST.

Any suggestion?

Thank you for your attention and for your answers!

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand your problem correctly, you might try one of the following:

The stack would work well to push the current tasks down on the stack you create. When the servant is done, they would just need to pop them back off the stack.

Implementing one of the following interfaces may be something you want to look at as well.


Check your java docs for more info.

Hope it helps.
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic