[wildfly-dev] Transactions in Batch (JSR 352)

David M. Lloyd david.lloyd at redhat.com
Wed Feb 4 14:50:10 EST 2015


On 02/04/2015 01:01 PM, Jesper Pedersen wrote:
> On 02/04/2015 01:55 PM, James R. Perkins wrote:
>>> Just remember that any non-transactional resources (NoTransaction)
>>> needs an explicit .close() in order to be returned to the connection
>>> pool. Otherwise you will out of connections fast ;) Scenarios like
>>> this can be investigated using the IronJacamar leak detector pool,
>   >
>> Right and this *should* happen in the Item(Reader|Writer).close()
>> correct? Of course the user needs to ensure that happens, but it's
>> "safe" assuming they do right?
>>
>
> Yeah, because there are no bugs in applications.
>
> ... Of course that doesn't explain why <ccm debug=true> and the leak
> detector pool are needed ... must be something else ...
>
> try/catch/finally is a good thing.

Connection objects are AutoCloseable, so you can even do:

   try (Connection c = ds.getConnection()) {
      // do stuff
   }

Simple and clean.
-- 
- DML


More information about the wildfly-dev mailing list