Click to See Complete Forum and Search --> : object pooling


ankur26
June 11th, 2001, 02:01 AM
hi, i am a beginer so plz correct me if i am wrong.
one of the features of mts is object pooling i.e it uses re uses a single object for many clients.

i ran the foll. sample code

<vbcode>
Dim c As rbsChargeCode.clsChargeCode
Dim i As Long

For i = 1 To 999
Set c = New rbsChargeCode.clsChargeCode

c.nSolutionId = i
c.nSectorId = 115
c.nClientId = 114
c.nEngagementId = 118
c.sChargeCodeDesc = "90ss"
c.sChargeType = "N"
c.Insert

Next

</vbcode>

rbsChargeCode is deployed in the mts. when i ran the code it actually made 999 objects in the mts. i.e in mts against my class clsChargeCode the objects and activated coloumn showed 999. i am using win 2000.

is it that mts is actually creating 999 objects of my class or my understnding is wrong.

If any one of u gurus could help me....

Thanks,
AnkuR.

berta
August 28th, 2001, 09:00 AM
U must reference your COM server to "MTS Transaction libray".. so your class must implemnet "objectcontrol" interface (IMPLEMENTS ObjectControl). Now U must Implements CanBePooled method:

Private Function ObjectControl_CanBePooled() As Boolean
ObjectControl_CanBePooled=true
End Function

hi,brt


<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/images/bertaplanet.gif'>
</center>