samedi 27 février 2016

Used and Unused db connection objects

I encountered a question where in we have a set of say DB connections and multiple users simultaneously request for them.

I must be able to provide them the Conn object from a pool of existing connectios, and once they are done using it, put it back into the same pool of available connections.

The approach I could think of was to have 2 sets for each used and unused connections and keep moving objects back and forth.

I am somehow not convinced it's the best way to do this.

Can anyone pls suggest a nicer approach? I was wondering if we could mark the connection obj as in use or something so that we can do away with these two sets?

Aucun commentaire:

Enregistrer un commentaire