Table of Contents Previous Next
Logo
The Ice Run Time in Detail : 28.6 The Ice::Current Object
Copyright © 2003-2008 ZeroC, Inc.

28.6 The Ice::Current Object

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:
module Ice {
    local dictionary<string, string> Context;

    enum OperationMode { Normal, \Nonmutating, \Idempotent };

    local struct Current {
        ObjectAdapter   adapter;
        Connection      con;
        Identity        id;
        string          facet;
        string          operation;
        OperationMode   mode;
        Context         ctx;
        int             requestId;
    };
};
Note that the Current object provides access to information about the currently executing request to the implementation of an operation in the server:
• adapter
The adapter member provides access to the object adapter via which the request is being dispatched. In turn, the adapter provides access to its communicator (via the getCommunicator operation).
• con
The con member provides information about the connection over which this request was received (see Section 33.5.1).
• id
The id member provides the object identity for the current request (see Section 28.5).
• facet
The facet member provides access to the facet for the request (see Chapter 30).
• operation
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.)
• mode
The mode member contains the invocation mode for the operation (Normal or Idempotent).
• ctx
The ctx member contains the current context for the invocation (see Section 28.11).
• requestId
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.
Table of Contents Previous Next
Logo