Re: [jgroups-users] Scope implementation for JGroups 4
Questions/problems related to using JGroups <[email protected]> Thu, 20 Jul 2017 11:33:29 +0200
| Newsgroups | gmane.comp.java.javagroups.general |
|---|---|
| Message-ID | <mailman.33159.1500543217.4001.javagroups-users@lists.sourceforge.net> |
On 20/07/17 10:19, Questions/problems related to using JGroups wrote: > The scope protocol has been removed from the stack in version 4. > Alternatively the application can now use AsynchronousInvocation with > RequestHandler and an application thread pool. However, with the scope > protocol one can take advantage of parallelism (among different scopes) with > sequential guarantee within a scope. How can the same be achieved via async > dispatching? Messages are still guaranteed to be delivered in send-order (and once-and-only-once, no duplicates). Let's take the example of web sessions (X, Y and Z) from the manual and say sender P sends 10 messages: P1-4 (session X), 5-6 (Y) and 7-10 (Z). The messages from the same session need to be delivered in order, e.g. P4 after P3, but messages P1-4 can be delivered in parallel to P5-6 and P7-10. Since all messages come from the *same sender P*, your handle() callback will be invoked with P1 first, then P2 ... P10: the ordering is guaranteed to be FIFO for P. If you for example have queues for each web session and add an incoming message to the corresponding queue, the messages in each queue are ordered correctly, e.g. X: |P1 P2 P3 P4|, Y: |P5 P6| Z: |P7 P8 P9 P10| If you allocate a thread for each session (or perhaps, better, a thread pool), then the thread for session Z needs to dequeue messages from Z's queue and deliver them to the application one-by-one; this guarantees sequential delivery of messages within the same session, but parallel delivery between different sessions. > The 'Message' structure and the RequestOptions used in RPCs do > not include get and set scope methods. Right, you need to add a 'scope' yourself, e.g. by using a part of the payload (the message's buffer), or - better - by adding an application header to each message. > Although the scope protocol and its > relevant thread-pools are now removed, retaining the scope variable in > request options and 'Message' structure will help in achieving the same > using an application thread-pool. > > > > -- > View this message in context: http://jgroups.1086181.n5.nabble.com/Scope-implementation-for-JGroups-4-tp11353.html > Sent from the JGroups - General mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > javagroups-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/javagroups-users > -- Bela Ban | http://www.jgroups.org ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot