Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the events are to be processed in a specific sequence, then why not try adding "eventID" and 'orderID' fields to the messages? This way your EventServiceImpl class can sort, order and then execute in the proper order (regardless of the order they are created and/or delivered to the handler).</p> <p>Synchronizing the <code>handler.execute()</code> block will not get the desired results, I expect. All the <code>synchronized</code> keyword does is prevent multiple threads from executing that block at the same time. It does nothing in the realm of properly ordering which thread goes next.</p> <p>If the <code>synchronized</code> block does seem to make things work, then I assert you are getting very lucky in that the messages are being created, delivered and then acted upon in the proper order. In a multithread environment, this is not assured! I'd take steps to assure you are controlling this, rather than relying on good fortune.</p> <p>Example:</p> <ol> <li>Messages are created in the order 'client01-A', 'client01-C', 'client01-B', 'client01-D'</li> <li>Messages arrive at the handler in the order 'client01-D', 'client01-B', 'client01-A', 'client01-C'</li> <li>EventHandler can distinquish messages from one client to another and starts to cache 'client01' 's messages.</li> <li>EventHandler recv's 'client01-A' message and knows it can process this and does so.</li> <li>EventHandler looks in cache for message 'client01-B', finds it and processes it.</li> <li>EventHandler cannot find 'client01-C' because it hasn't arrived yet.</li> <li>EventHandler recv's 'client01-C' and processes it.</li> <li>EventHandler looks in cache for 'client01-D' finds it, processes it, and considers the 'client01' interaction complete.</li> </ol> <p>Something along these lines would assure proper processing and would promote good use of multiple threads.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload