Ice::Application helper class encapsulates some basic Ice functionality such as communicator initialization, communicator destruction, and proper handling of signals and exceptions. The
Ice::Application to add functionality that is commonly needed by Glacier2 clients:
- Keeps a session alive by periodically sending "heartbeat" requests
- Automatically restarts a session if a failure occurs
- Optionally creates an object adapter for callbacks
- Destroys the session when the application completes
Glacier2 Application is defined as follows :
The intent of this class is that you specialize Glacier2
Application and implement the pure virtual functions or abstract methods
runWithSession in your derived class.
This Application class provides the following functions or methods:
Like the Ice Application constructor, you can construct a Glacier2 application that handles signals (the default) or does not.
This pure virtual function or abstract method must be overridden by a subclass to create the application's Glacier2 session. A successful call to
createSessionis followed by a call to
runWithSession. The application terminates if
This pure virtual function or abstract method must be overridden by a subclass and represents the "main loop" of the application. It is called after the communicator has been initialized and the Glacier2 session has been established. The arguments passed to
runWithSessioncontain the arguments passed to
Applicationwith all Ice-related options removed. The implementation of
runWithSessionmust return zero to indicate success and non-zero to indicate failure; the value returned by
runWithSessionbecomes the return value of
restartto restart the session. This destroys the current session, creates a new session (by calling
createSession), and calls
Applicationbase class also restarts the session if
runWithSessionraises (or allows to be raised) any of the following exceptions:
All other exceptions cause the current session to be destroyed without restarting.
A subclass can optionally override this function or method to take action when connectivity with the Glacier2 router is lost.
Returns the proxy for the Glacier2 router.
Returns the proxy for the current session.
Applicationto destroy the current session, create a new session (by calling
createSession), and start a new main loop (in
runWithSession). This function or method does not return but rather throws a
RestartSessionException, later caught by
Returns the category to be used in the identities of all of the client's callback objects. Clients must use this category for the router to forward callback requests to the intended client. This function or method raises
SessionNotExistExceptionif no session is currently active.
Creates a new Ice identity for a callback object with the given identity name.
Adds a servant to the callback object adapter's Active Servant Map using a UUID for the identity name.
Returns the object adapter used for callbacks, creating the object adapter if necessary.