omn​​iORBpy终止服务器

时间:2011-12-07 16:22:28

标签: python corba

我正在使用omniORBpy的python客户端 - 服务器应用程序,我正试图弄清楚如何正确终止服务器。

我有这样做的方法:

def shutdown(self):
    print "---------------------------------------"
    print "shutdown"
    orb.shutdown(False)
    quit()

但是当我从客户端发送一条调用上述函数的消息时,会收到此错误:

---------------------------------------
shutdown
omniORB: Caught an unexpected Python exception during up-call.
terminate called after throwing an instance of 'omni_thread_fatal'
Aborted

有人知道我该如何正确终止服务器?

2 个答案:

答案 0 :(得分:0)

您是否在IDL中将关闭方法设为单向方法?

答案 1 :(得分:0)

您无法关闭服务器(即使不是单向呼叫)。您必须更改“标志”,以便经常检查。如果已设置,请关闭服务器。

,例如,伪代码:

def shutdown():
  self.shutdown = True

def run():
  while not self.shutdown:
     workloop()

或类似的东西。换一种说法;不要在远程调用中终止服务器。