Archived

This forum has been archived. Please start a new discussion on GitHub.

help in IceStorm

hi!
I tried to write an application using IceStorm: I have 1 subscriber, 1 publisher and a program which act as subscriber for the second one and as publisher for the first one. When I try to close this last program with CTRL+C it does nothing, so for closing it I have to do CRTL+Z but in this case in the shell where I write this comand:
" icebox --Ice.Config=config.icebox "
it doesn't unsubscribe the application.. it still flushing the object.
How can I resolve this problem?
Thank you,
Sincerely Marika

Comments

  • matthew
    matthew NL, Canada
    What application precisely are you trying to terminate with ^C? Did you try the clock demo? If so, did this work as you expect?
  • I modified the clock demo adapting it with my scene, so I create a publisher "BodyNetwork" which asks an integer value and sends the message to the subscriber called "Gateway" that is subscribed to the same topic of the publisher. Then the "Gateway" is taken care to send to the subscriber "Hospital" a message of alarm. So there is another topic name between "Gateway" and "Hospital".
    For doing this I thought to create "Gateway" both as publisher and subscriber: after activating the adapter (so it is still subscriber) I put the code for the publisher for sending an alarm message to the "Hospital" but then I can't call "waitForShutDown".
    When I want to terminate the application, the publisher "BodyNetwork" ends
    correctly because it ends to ask the values; the subscriber "Hospital" ends with ^C and it will unsubscribe from IceStorm; but for terminating the publisher/subcriber "Gateway" I must do ^Z, but in this case it only stops the application and doesn't kill it, so it will not unsubscribe from IceStorm.
    If necessary I put my source code.
    Thanks,
    Marika
  • matthew
    matthew NL, Canada
    If you are using Ice::Application the default behaviour is to destroy the communicator upon reception of a SIGINT. In this case the next message you sent to IceStorm will result in a CommunicatorDestroyedException. You can then key on this to determine that the app has been interrupted.

    Another approach is to create a thread which does the message publishing, and call waitForShutdown() in the main thread. In this case call Ice::Application::shutdownOnInterrupt(). Once waitForShutdown() has returned then you can terminate the thread and exit the application.
  • ok, I resolved the problem!
    Thank you! :)
    Bye Marika