ObjectControl::CanBePooled method (comsvcs.h)
Indicates whether the object can be pooled for reuse when it is deactivated.
Syntax
HRESULT CanBePooled(
[out] VARIANT_BOOL *pbPoolable
);
Parameters
[out] pbPoolable
Indicates whether the COM+ run-time environment can pool this object on deactivation for later reuse.
Return value
This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, E_FAIL, and S_OK.
Remarks
When an object returns TRUE from CanBePooled, it indicates to the COM+ run-time environment that it can be added to an object pool after deactivation rather than being destroyed. Whenever an instance is required, one is drawn from the pool rather than being created.
Returning TRUE from CanBePooled does not guarantee that objects will be recycled; it only gives the COM+ run-time environment permission to recycle them. Returning FALSE from the CanBePooled method guarantees that instances of a component are not recycled.
The Activate method is called if a new instance is created or if a recycled instance is drawn from the pool. Similarly, the Deactivate method is called every time the object is deactivated, whether it is being destroyed or returned to the pool for recycling.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | comsvcs.h |