Hi Rickard,
>> ...what if a bean "steals" a connection because it wants to keep a
>> result set open across business method calls, e.g. to implement
>> the "stateful session bean facade as remote scrollable cursor"
>> pattern? I'm not recommending this architecture (blech), but it's
>> legal. In this case, you wouldn't want other components reusing
>> this connection, right?
RO> Not sure. Would it be possible to code ResultSet so that .close does the
RO> connection return thingy? That should be ok I think.
I like your idea very much, it would prevent many headaches.
But I'm afraid that Dan OConnor's argument is valid.
If we don't return Connection to the pool if is has at least one open
ResultSet, then we get rather weak protection of the server against
programming errors, garbage Connections are possible and even rather
probable.
I think that Dan Christopherson's 'grim reaper' would solve the
problem. We could add "Connection/resource out of pool timeout" and
starts counting from the end of the business method. I would like to
set it to zero, not in the sense of "infinite", but in the sense
"return to the pool immediately".
One more idea: I think that on non-application exception
(aka RuntimeException) container should release all resources.
This would improve the situation with the garbage connections.
Can't the following extract from 17.2.2 be treated in this way?
"The Bean Provider can rely on the Container to perform
the following tasks when catching a non-application exception:
- The transaction in which the bean method participated will be rolled
back.
- No other method will be invoked on an instance that threw a
non-application exception."
And I have one doubt about the following situation (slightly
off-topic). A bean get the Connection and set some transaction
isolation level, say TRANSACTION_READ_UNCOMMITTED. Then the Connection
returns to the pool. Shouldn't its attributes be returned to the
original state? Otherwise there will be an unpleasant surprise on
the reusing of the Connection.
Regards,
Oleg
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]