Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock question

 
S. Palanigounder
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a client closes a connection obtained from the connection pool, which of the following occurs?
1. The connection is permanently closed
2. The connection is never closed - simply returned to the pool
3. The connection is closed, but reopened and returned to the pool
4. Impossible to tell for sure with the given information

I think ans is 4.
 
Sudd Ghosh
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't this related to the way container manages the instance pooling of the beans ? Are we expected to know these internals of connection pooling for SCBCD ? I thought the container takes care of such low-level details and we are supposed to know ony the client interfaces and the functions provided by the container .. among other things.
Thanks, Sudd
 
Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, we must know such stuff. In objectives it is named smth like 'name the container's reponsibilities for managing resources'. DataSource has an implementation of a connection pool and is set up by the Deployer and managed at runtime by the container.
The answer for the question above is
2. The connection is never closed - simply returned to the pool
If you look at the code for the implementation of DataSource, the method close() doesn't close the connection directly, but marks the connection as closed, thus free for reuse. Reopening the connection would kill the very purpose of the pool.
The actual number of connections (min and max, timeouts, etc.) is specified in a vendor-specific way.
Cheers
 
S. Palanigounder
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method close() is called on Connection interface, not
DataSource. The implementation of Connection is
depended on the vendor.
 
Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, sure Writing such things this late in the night is hazardous for your knowledge
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all -- you are *not* expected to know implementation details or ANYTHING that is vendor-specific.
All you need to know about resource manager connection factories is how they are accessed in code (by a bean), how they are named in the deployment descriptor, which EJB role is responsible for the deployment descriptor elements (and which role is responsible for the final mapping of resource references to actual JNDI configurations of the resource), and finally -- the points in a bean's lifecycle during which you can access those resources.
You also need to know that the EJB specification guarantees support for JDBC 2.0, but you do NOT need to know anything at all about what JDBC 2.0 provides. So, the specification does not directly guarantee connection pooling, and the EJB deployment descriptor does not contain any tags for configuring connection pool information, so -- you won't be tested on it!
There, I managed to eliminate ONE of the 10,000 things that you have to know for the exam
cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic