具有计时器事件的 CORBA 对象
我有一个程序,它创建 CORBA 对象,这些对象订阅不同的事件(来自其他远程 CORBA 对象),并记录在数据库中接收到的每个事件。问题是我还希望该对象每分钟向另一个远程 CORBA 对象发送请求。
我该怎么做?
也许为每个创建的 CORBA 对象启动一个附加线程并使用它来 ping 我的对象?
或者也许我可以使用 POA 并告诉它向我的所有对象发送消息(但不阻塞)?或者从 POA 请求信息并进行自己的调用(但也不会阻塞)?
I have a program that creates CORBA objects which are subscribed for different events (from other remote CORBA objects) and log every event that thay receive in a database. The problem is that I also want this objects to send request to this other remote CORBA object every minute.
How can I do this?
Maybe start an additional thread for every created CORBA object and use it to ping my objects?
Or maybe I can use POA and tell it to send a message to all my objects (but without blocking)? Or request information from POA and make my own invocation (but also without blocking)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将启动一个计时器线程,在循环中等待一分钟,当时间到时,在循环中调用所有已注册的对象(前提是该调用不需要线程一般无法提供的参数)。
然后您所要做的就是将您想要每分钟调用的所有对象引用放入一个列表中(确保适当地保护对列表的访问)。
I would start a timer thread that waits a minute in a loop and when the time is up calls all registered objects in a loop (providing that the call needs no arguments that the thread can not provide generically).
All you have to do then is to put all the object references you want to call every minute into a list (make sure to protect the access to the list appropriately).