Consider using Pooling CreationPolicy

Mar 13, 2009 at 1:26 PM
There are currently 3 types of instances creation policy in your framework :
1. "Shared" - Singleton pattern
2. "NonShared" - Prototype pattern
3. "Any"

Consider adding 4th policy - "Pooling".
Framework can support pools for objects of specified maximum size to achieve instances reuse. Poolable objects can implement IDisposable where they should "clear up" themselves and prepare to be used by another thread. Framework can dynamically increase objects count in pool up to pool's maximum size. Instance, returned to the client, is marked as "is use" until it's disposed - and being reclaimed by the framework's pool. Pools continue to live (and references to poolable objects are kept) as long as the MEF container lives.

Any suggestions on the proposition ?
Mar 13, 2009 at 4:52 PM

Hi,

Thanks for your suggestion, it seems like something we’d consider in the future. Can you share a bit more information about your scenario though? I.e what kind of objects would be pooled?

(BTW, #2. isn’t precisely the Prototype pattern since there is no prototype instance being duplicated. Other names for what we call ‘non-shared’ are ‘transient’ or ‘per-call’.)

Cheers,

Nick

From: Timong [mailto:notifications@codeplex.com]
Sent: Friday, March 13, 2009 6:27 AM
To: Nicholas Blumhardt
Subject: Consider using Pooling CreationPolicy [MEF:50109]

From: Timong

There are currently 3 types of instances creation policy in your framework :

1. "Shared" - Singleton pattern

2. "NonShared" - Prototype pattern

3. "Any"

Consider adding 4th policy - "Pooling".

Framework can support pools for objects of specified maximum size to achieve instances reuse. Poolable objects can implement IDisposable where they should "clear up" themselves and prepare to be used by another thread. Framework can dynamically increase objects count in pool up to pool's maximum size. Instance, returned to the client, is marked as "is use" until it's disposed - and being reclaimed by the framework's pool. Pools continue to live (and references to poolable objects are kept) as long as the MEF container lives.

Any suggestions on the proposition ?

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com