Archived

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

Wrapping Ice.Application with Java

Hi,

I have gotten a number of Ice applications working using Java and now am trying to make a class that completely wraps all the Ice calls, thus allowing classes that do not implement Ice.Application to use Ice.

My question is about Ice.Communicator startup; is checking for communicator() != null good enough to ensure that the core us up and running?

I have a class that extends Ice.Application and in its init() it starts a thread that starts the Ice core by calling Ice.Application.main() which consists of communicator().waitForShutdown(). init() then waits until communicator() != null before exiting. At this point Ice communication can occur and other classes can use any Ice calls that it wraps.

Is this reasonable or is there some other suggested method of doing this that I am not aware of?

Thanks.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Is there any particular reasons why you need to use Ice.Application?

    It seems to me that your init() method just needs to create a communicator. Note that you don't have to use Ice.Application to initialize the Ice runtime, you can simply create a communicator. For an example, see demo/Ice/minimal (which doesn't use Ice.Application). The section "3.4 Writing an Ice Application with Java" in the Ice manual also shows how to create a communicator.

    Cheers,
    Benoit.
  • Ignorance is the only reason; thanks.