本文整理匯總了Python中pyon.net.endpoint.RPCServer.close方法的典型用法代碼示例。如果您正苦於以下問題:Python RPCServer.close方法的具體用法?Python RPCServer.close怎麽用?Python RPCServer.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyon.net.endpoint.RPCServer
的用法示例。
在下文中一共展示了RPCServer.close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TransformBase
# 需要導入模塊: from pyon.net.endpoint import RPCServer [as 別名]
# 或者: from pyon.net.endpoint.RPCServer import close [as 別名]
class TransformBase(SimpleProcess):
'''
TransformBase is the base class for all Transform Processes
'''
def __init__(self):
super(TransformBase,self).__init__()
self._stats = {} # Container for statistics information
def on_start(self):
'''
Begins listening for incoming RPC calls.
'''
super(TransformBase,self).on_start()
self._rpc_server = RPCServer(self, from_name=self.id)
self._listener = gevent.spawn(self._rpc_server.listen)
def on_quit(self):
'''
Closes the listener.
'''
self._rpc_server.close()
self._listener.join(5)
super(TransformBase, self).on_quit()
def _stat(self):
return self._stats
@classmethod
def stats(cls,pid):
'''
RPC Method for querying a Transform's internal statistics
'''
rpc_cli = RPCClient(to_name=pid)
return rpc_cli.request({},op='_stat')