Click or drag to resize

IPooledComponent Interface

Components implementing this interface are aware that they are pooled, so will be notified when they are retrieved from the pool, and when they are returned to the pool.

Namespace:  Autofac.Pooling
Assembly:  Autofac.Pooling (in Autofac.Pooling.dll) Version: 1.0.1+e2b1e849d21d04643649a531a7435392bb1a29cd
public interface IPooledComponent

The IPooledComponent type exposes the following members.

Public methodOnGetFromPool
Invoked when this instance is retrieved from the pool. Any dependencies retrieved using the provided IComponentContext MUST be discarded in OnReturnToPool, otherwise memory leaks may occur.
Public methodOnReturnToPool

Invoked when this instance is being returned to the pool. Any dependencies retrieved in OnGetFromPool(IComponentContext, IEnumerableParameter) should be discarded in this method.

If the maximum pool capacity has been reached (or a custom IPooledRegistrationPolicyTPooledObject decides not to return the instance to the pool), this method will be invoked, but then the object will not be put back in the pool (and may be disposed if the component implements IDisposable).

See Also