One potential source of problems might be the start/run sequence of the 
Thread. If, for some reason, the run() method was never called then the 
Thread's connection would never be called. The "problem" with this 
theory is that I cannot think of any reason for start() to fail to call 
run()... :).

Just to verify that's not the problem, you could pass the DBPool as 
parameter to the tread and perform the DBPool.getConnection() inside the 
thread's run method, so the connection is retrieved in the same method 
where you are sure it is going to be returned.

And as Jon said, you should remove the dummy Connection conn = 
ds.getConnection(); piece of code, because right now it does nothing and 
adds confusion to the diagnostics. It is better to reduce it to just one 
piece of code with connections involved :).


.pQd escribió:
> hi Jon,
>> if t[i].join(); (or anything) throws an exception, then the first
>> connection
>> that you open will dangle. Do you see "we've got an exception" anywhere in
>> your logs? put *all* the conn.close() in finally blocks... also, what is
>> the
>> point of calling ds.getConnection() two times?
> thx for your answer! 
> this is just dummy code with which i can still reproduce the problem.
> i removed as much as possible [ including some try-caches ] but kept what is
> needed to reproduce the problem. i understand that code looks odd after
> taking out most of actual work that is done, but in this way it's [
> hopefully ] readable.
> in my case other exceptions [ than reported IllegalStateException ] do not
> occur. 
> so none of code in catch is executed.
>> Your code should be:
> actually i'm very close to your suggestion. i usually run:
> }finally{
>  try{ 
>   if (conn!=null) conn.close()
>  }catch(Exception e){
>  }
> }
> regards
> Pawel Kudzia

resin-interest mailing list

Reply via email to