Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To Paul : Question about Queue In MDB

 
Mahara J
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
I am following SCBCD- exam study Kit. In MDB chapter- review question no.8

Which of the following are true statements about an MDB associated with a Queue ?
a) Only one instance from the pool of an MDB type can process a message at a given time.
b) Multiple instances from the pool of an MDB type can process messages at the same time.
c) One instance can handle only one message at a time.
d) A message will go to only one bean instance.

ANSWER: B,C,D

Paul,you have given nice explanation for this answer .
As a amateur in MDB, i can't get it. Can you please explain this with some example.

Thanks,
Jo.
 
Kay Ra
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is ACD I don't agree with B.
multiple instances of an MBD type should not get the msg.
The expannation for this can be illustrated by this example.
Let is say we have a msg on receipt on it we need to update a db.So if we have tied it to a queue so only one instance of that msg bean from the pool should get it and act upon it, in this case updating the dtabase.
Secondly if you are associating with a topic. then there are multiple msgbeans type listening. So only one instance of each type will act upon the mss eg. 1 instance from MsgBeanType1 its home MSgBeanType1Home and 1 instance from MsgBeanType2 its home being MsgBeanType2Home.

kay
SCWCD
SCBCD
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EJB container is multithreaded. For pooled beans, each request (or message if we are talking about MDBs) is typically run in a separate thread. Multiple messages will be processed concurrently by pulling the necessary number of beans from the pool. So, B is correct.
 
Vinh Hoang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This book has an online support at
http://www.manning.com/sanghera
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Jo"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Thomas Vezhambacheril
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also think ACD is correct.

Queue means one instance can processes a message at a time. isn't it ?

Thomas
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) Only one instance from the pool of an MDB type can process a message at a given time.
b) Multiple instances from the pool of an MDB type can process messages at the same time.



B.. is okay, because, if 2 messages are received, then 2 mdbs will handle it. Remember that there can be more than one source of message. So for example, at an instant, 2 messages for same MDB type can arrive, and so 2 MDBs will handle it.


A.. is wrong as it is stating a general statement that, "in the entire pool, at any instant, at most, one and only 1 MDB is actively processing something". This is wrong as there can be 2 MDBs from the same pool that are active at a certain moment.
 
Mahara J
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark ,
I don't know about Naming policy.This is my real name.But for Last name i added initial.Is it ok?
Thanks for the notification.
Jo
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic