开发者

Creating a connection (object) pool - any libraries to use?

We have a 3rd party piece of software that uses a bunch of internal middleware and services to connect to outside databases. Through this API I o开发者_C百科nly have a bit of information on the connection object it uses when contacting an Oracle DB.

Update: This isn't a pooling to connect to Oracle. This is a pool of objects/connections to a piece of software that deal with massive amounts of statistical data which in turn has it's own connections to Oracle. The reason we need pooling is this software can be accessed 50-200 times a second, and it can takes over 20 seconds to instantiate the Initiate object.

What I'm wondering is if .NET has any classes I can inherit / use to help me build a better object pooling system than what is currently written. I have no problem writing my own, but I'd rather not re-invent the wheel if I could inherit from one.

Note, this is pretty much object pooling, but the objects have the ability to connect.

Update: The current system works once the pool is created. It has a worker thread that ensures the pool is clean and working. The problem comes in when the Application gets no activity for a long time. When a request comes in, the system looks for a connection and they're all cleaned up (I believe because the cache is gone). So it regenerates them, but this can take upwards of 1 minute to do the 100+ connections, and the request can time out due to this being accessed through SOA.


You can implement your own using Object Pool Design pattern: http://sourcemaking.com/design_patterns/object_pool

or use this one: C# Object Pooling Pattern implementation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜