General information
Category:
Conferences & events
>According to Randy Brown the blocking is on a method-by-method basis. In other words, two clients can run different methods concurrently, but not the same method. I guess the effects of this depend on your class design. I haven't had a chance to test this. Anyone else tried it out?
Only if the methods are in different DLL's.
Here is a class in which you can try this:
DEFINE CLASS MTSServer as Custom OLEPUBLIC
oAPPServer = .NULL.
oObjectContext = .NULL.
cErrorMsg = ""
FUNCTION FastHit
THIS.oAppServer = CREATE("MTXaS.Appserver.1")
THIS.oObjectContext = THIS.oAppServer.GetObjectContext()
THIS.oObjectContext.SetComplete()
RETURN "Done. " + TIME()
FUNCTION SlowHit
LPARAMETER lnSecs
lnSecs=IIF(type("lnSecs")="N",lnSecs,5)
THIS.oAppServer = CREATE("MTXaS.Appserver.1")
THIS.oObjectContext = THIS.oAppServer.GetObjectContext()
lcOutput = ""
FOR x = 1 to lnSecs * 300000
i=1
ENDFOR
THIS.oObjectContext.SetComplete()
RETURN lcOutput + "Done waiting for "+STR(lnSecs)+" secs"
FUNCTION Error
LPARAMETER lnErrorNo, lcCode, lnLine
THIS.cErrorMsg = THIS.cErrorMsg + STR(lnErrorNo)+ " - " + STR(lnLine) + " "+lcCode + " - " +Message()
ENDFUNC
ENDDEFINE
You need to create a VFP dll and add it to a new MTS package. In the properties, be sure to check the requires transactions box.
What you do now is fire up two instances of VFP and in each instance of VFP, create an instance of this class. In one instance, invoke the SlowHit() Parameter passing the number 35 to make the method run for 35 seconds. Once you have done this, quickly go to the other VFP session and invoke the fasthit() method. You will see things hang until the slowhit is done in the other session. Once that is done, the fasthit method will come back.
What I have just described and what you have seen is the big problem facing VFP servers right now. I know the VFP team is working on this issue as it is recognized to be a big problem. How does this compare to VB... Well, VB does it right. While the 35 second method is running, the fasthit will work immediately. ie, VB can process things concurrently. Here is the VB code if you are interested:
Public oAPPServer As Object
Public oObjectContext As Object
Public cErrorMsg As String
Function FastHit()
Set oAPPServer = CreateObject("MTXaS.Appserver.1")
Set oObjectContext = oAPPServer.GetObjectContext()
oObjectContext.SetComplete
FastHit = "Done. " + Str(Now())
End Function
Function SlowHit()
Dim lnsecs As Integer
Dim lcoutput As String
lnsecs = 35
Set oAPPServer = CreateObject("MTXaS.Appserver.1")
Set oObjectContext = oAPPServer.GetObjectContext()
lcoutput = ""
For x = 1 To lnsecs * 300000
i = 1
Next x
oObjectContext.SetComplete
SlowHit = lcoutput + "Done waiting for " + Str(lnsecs) + " secs"
End Function
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only