You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@river.apache.org by Zsolt Kúti <la...@gmail.com> on 2015/01/07 10:27:22 UTC

Javaspaces object flow design question

Hi,

I turn with my problem to you experienced people for help.
It seems to be a basic problem still cant see the correct solution.

Consider the following requirement:
- given two services, one of them (S) periodically wants to write entries
(Es)
for ones (P) that consume and make processing based on Es
- processing may take so long that a new E that would induce (almost) the
same processing may arrive in the meantime and its writing to the space
must be prevented until the previous E's processing is finished


All the schemes I could come up till now involves a small time window where
problem can occur.
One of them is:
- E has a state field, that can have either TO_BE_PROCESSED, or PROCESSING
- S reads if E of TO_BE_PROCESSED exists, if not, writes one of that state
- a P takes E with this state (thereby not letting other Ps to chip-in),
changes E to PROCESSING,
and writes back; when finished removes E

Here in the last step there is a small chance for S where it cannot see
that E and writes a new one, so an other P will start a new useless
processing.

I would appreciate your suggestions.

Zsolt