Up to now, we have tacitly ignored the trailing parameter of type Ice::Current that is passed to each skeleton operation on the server side. The
Current object is defined as follows:
Note that the Current object provides access to information about the currently executing request to the implementation of an operation in the server:
The operation member contains the name of the operation that is being invoked. Note that the operation name may indicate one of the operations on
Ice::Object, such as
ice_ping or
ice_isA. (
ice_isA is invoked if a client performs a
checkedCast.)
The Ice protocol (see Chapter 34) uses request IDs to associate replies with their corresponding requests. The
requestId member provides this ID. For oneway requests (which do not have replies), the request ID is
0. For collocated requests (which do not use the Ice protocol), the request ID is
‑1.
If you implement your server such that it uses a separate servant for each Ice object, the contents of the
Current object are not particularly interesting. (You would most likely access the
Current object to read the
adapter member, for example, to activate or deactivate a servant.) However, as we will see in
Section 28.7, the
Current object is essential for more sophisticated (and more scalable) servant implementations.