• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Concurrency for MDB's

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

The following lines are from O'Reilly's book,

In MDB's concurrency refers to the processing of more than one message at a time. If MDB's could process only a single message at a time, then they would practically be useless in a real-world application because they could not handle heavy message loads.

They show a diagram where in three message arrives and three instances of MDB's are pulled out from the pool to process these messages. My question here is doesn"t concurrency mean processing of the all three messages by a single MDB instance? Please advice guys!
 
Ranch Hand
Posts: 290
Oracle Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, that would be serial processing. MDB's can process multiple messages at the same time by using the MDB pool. So it is concurrent processing.

Aryan
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so concurrency here does not mean thread safety?
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Generally speaking for queues, you could have a pool of MDBs each receiving a subset of the messages coming in but there are two things to be worried about:

- You can't control order of messages in queues. You never can. You may process messages that are newer than some old messageswaiting to be processed (even in the case of a single MDB in the pool this can happen).

- You can't control which MDB in the pool gets messages so you need some kind of persistent storage device like a database coordinating multi-step communications such as negotiating a customer transaction.

And if you follow the EJB spec, everything is thread safe. The only time you violate thread safe is if you spawn your own threads.
[ September 28, 2008: Message edited by: Scott Selikoff ]
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic