How do you do object pooling in .NET
How do you do object pooling in .NET ?
COM+ reduces overhead by creating object from scratch. So in COM+ when object is activated
its activated from pool and when its deactivated it’s pushed back to the pool. Object pooling is
configures by using the “ObjectPoolingAttribute” to the class.
Note:- When a class is marked with objectpooling attribute it can not be inherited. ObjectPooling(MinPoolSize := 2, MaxPoolSize := 5, CreationTimeout := 20000)> _
Public Class testingclass Inherits ServicedComponent Public Sub DoWork() ' Method contents go here. End Sub End Class
Above is a sample code which has the “ObjectPooling” attribute defined. Below is a sample code which uses the class.
Public Class App Overloads Public Shared Sub Main(args() As String) Dim xyz As New TestObjectPooling() xyz.doWork() ServicedComponent.DisposeObject (xyz) End Sub End Class
Above is a sample code which uses the object pooled object. Note the DisposeObject() This ensures its safe return to the object pool.
2007-10-22, 4748👍, 0💬
How To Display a Past Time in Days, Hours and Minutes? - MySQL FAQs - Managing Tables and Running Qu...
How To Run "mysql" Commands from a Batch File? - MySQL FAQs - Command-Line End User Interface mysql ...
What is the quickest sorting method to use? The answer depends on what you mean by quickest. For mos...
How can you determine the size of an allocated portion of memory? You can't, really. free() can , bu...
What exactly happens when ASPX page is requested from Browser? Note: - Here the interviewer is expec...