• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A problem in Connection pool design

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i try to design a Connection pool by Dynamic Proxy.
when the pool user invoke conn.close() method,with Dynamic Proxy,the Connection pool can just recycle the Connection instead of close the Connection.

the pool user call:

to get a Proxy Connection Object,and finish some SQL operation,and then he invoke
the Connection pool set the inUse flag of this conneciton object into false,in this way, the pool can return the free Connection judge by the inUse flag which is false;
if the flag is false,the Proxy hold up all the method,an the user can not use this connection anymore;

now there is another user,he call:

if unfortunately,the object conn2 refer to is the same as conn1 refer to.
the pool set the flag into true,and the proxy cancel hold up the method invocation.
then the problem occur,in this time,the refer variable 'conn1' can use the connection object again!
so,who can i break the refer between refer conn1 and the connection object?
or some other way I can do in the Proxy class?
thank you!
 
Grow a forest with seedballs and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic