direct.distributed.AsyncRequest¶
from direct.distributed.AsyncRequest import AsyncRequest, cleanupAsyncRequests
Inheritance diagram
digraph inheritancea8a0b7350f { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "AsyncRequest" [URL="direct.distributed.AsyncRequest.html#direct.distributed.AsyncRequest.AsyncRequest",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="This class is used to make asynchronous reads and creates to a database."]; "DirectObject" -> "AsyncRequest" [arrowsize=0.75,style=""]; "DirectObject" [URL="direct.showbase.DirectObject.html#direct.showbase.DirectObject.DirectObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="This is the class that all Direct/SAL classes should inherit from"]; }- class AsyncRequest(air, replyToChannelId=None, timeoutTime=8.0, numRetries=0)[source]¶
Bases:
DirectObjectThis class is used to make asynchronous reads and creates to a database.
You can create a list of self.neededObjects and then ask for each to be read or created, or if you only have one object that you need you can skip the self.neededObjects because calling askForObject or createObject will set the self.neededObjects value for you.
Once all the objects have been read or created, the self.finish() method will be called. You may override this function to run your code in a derived class.
If you wish to queue up several items that you all need before the finish method is called, you can put items in self.neededObjects and then call askForObject or createObject afterwards. That way the _checkCompletion will not call finish until after all the requests have been done.
If you need to chain serveral object reads or creates, just add more entries to the self.neededObjects dictionary in the self.finish function and return without calling AsyncRequest.finish(). Your finish method will be called again when the new self.neededObjects is complete. You may repeat this as necessary.
- notify = <direct.directnotify.Notifier.Notifier object>¶