Re: Pattern for One-Entry-Multiple-Workers Problem

Stefan Schulz <[email protected]>
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
John McClain - Sun Microsystems, Inc. wrote:
> Stefan Schulz wrote:
>> In the end, there is still the alternative to (externally) trigger a
>> contents()/iterator-base operation, as mentioned by Gregg. Although, not
>> very elegant, maybe the easiest and most complete way to do it. Hm.
>
> Just so I can understand, can you write about why you consider
> a contents based solution "inelegant"?

It's non-elegant in my scenario, as each worker would have to touch all
matching entries instead of only the one(s) yet unprocessed by him.

In a scenario, where only one result is expected, a worker could react
upon receiving a notification, (try to) take the entry and either
"replace" the entry with the result entry or "mark" the entry to be
processed. Hence, each requesting entry only is read once by a worker.

In my scenario, however, multiple independent results of an undetermined
number are expected as response to one requesting entry. Using
contents(), each worker has to read such entries multiple times, as they
do not get "consumed", until the requesting manager decides to.

I think, the Call for Papers-Example makes it easier to understand:
you can either ask your students to read all the CfPs kept as unordered
stack on the secretaries desk regularily, triggered by an email stating
that "a new CfP has arrived", or you send a new CfP (as a copy and
notification in once) to each of them.

I learned that the latter obviously is possible by using availability
notifications in JavaSpace05. To guarantee a worker seeing all
requesting entries, however, the contents() method would still have to
be applied. Hence, the contents() approach seems more complete.

Cheers,
Stefan

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

JDC members can download the JavaSpaces(tm) Technology from:
http://developer.java.sun.com/developer/products/jini/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.