Re: Pattern for One-Entry-Multiple-Workers Problem
Dan Creswell <[email protected]>
| Newsgroups | gmane.comp.java.sun.javaspaces |
|---|---|
| Message-ID | <[email protected]> |
So, I feel like I must be missing something because it looks to me like you could achieve most of this with registerForAvailabilityEvent. Each worker interested would register for matches and would receive a copy of the Entry in the event. It could then process the Entry and write back a new Entry. Two things: (1) A worker on startup might need to use contents to check for any work pre-existing in the space prior to registration. (2) A worker might sometimes want to do contents if it's not seen any events recently to ensure none have been lost. Still not sure I understand...... Dan. Stefan Schulz wrote: > Hi, > > from the response I understand, that my problem description was not > clear enough. > > I shouldn't have used Xij but Yj(Xi), i.e. a Worker Wj produces exactly > one new entry Yj based on the input Xi. This is done by all of the > Workers concurrently, without them knowing about each other, and for: > j != k > follows that > Yj(Xi) != Yk(Xi). > > The Xi and Yj(Xi) stay in the space until the manager decides the > process to be finished, than he will take the Xi and all accordingly > produced Yj(Xi) from the space. > > The ordered distributed data structure would not help, as it assumes the > Xi to be consumed and only one output is expected from any of the > Workers, which is not the case. > > Of course, one could do a contents() and iterate on all matching Xi, > which would include taking it and having the actual object of the entry > to support some signature feature, which can be checked and set during > the loop. I just think, that this is no "elegant" solution :) > > Thanks, > Stefan > >> Stefan Schulz wrote: >> >>> Hi, >>> >>> I am looking for a pattern to solve the following problem within >>> JavaSpaces: >>> >>> - A Manager M writes Xi to the space. >>> - Each participating Worker Wj reads Xi and produces Xij. >>> - Each Wj should read a specific Xi only once. >>> - Xi is written to the space, but never taken/removed. >>> >>> Where: >>> - i and j are arbitrary numbers. >>> - Xij is the result of an entry Xi processed by Worker Wj. >>> - the number of produced Xi and participating Wj is not known. >>> - the number of produced Xij is i x j. >>> >>> As far as I understood, a read on the space returns an arbitrary, >>> matching entry, which (in worst case) always is the same entry. Is the >>> above problem solvable within JavaSpaces at all? Or would one need >>> JavaSpace05 to walk through all available matching entries and provide a >>> signature/marking/logging-mechanism to check for unprocessed entries? >>> > > =========================================================================== > 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/ > =========================================================================== 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/