Name

ResultObject — object tracking status of a remote call, destination of call results.

Synopsis

class ResultObject : public Object
    {
public:

    enum State;

public:

    PEnum< State >        state;

    PPointer< Throwable > exception;

public:

    void cancel() const;

    std::auto_ptr< MethodPacket > create_results() const;
    };

Description

ResultObject is returned by asynchronous call stub when the RPC_RESULTS flag is set using the param() method. It can be used to monitor the call state and inspect its results.

[Note]Note

ResultObject is used internally to implement the SRPC and offers more methods and data for that purpose. You should use only features described in this documentation.

Call State

The state field of an ResultObject may contain one of the following values:

Table 8.2. ResultObject state
NameDescription
STATE_UNKNOWNWaiting for a reply to the call request.
STATE_SUCCESSThe call has succeeded. Use the create_results() method to retrieve the results.
STATE_DELIVERY_FAILEDFailed to deliver the request to the callee object.
STATE_UNSUPPORTED_INTERFACEThe callee object does not implement the requested interface. Check Section 8.4.2.2, “Exceptions Thrown By The Core”, description of IllegalPointerConversionException, to see when this may happen.
STATE_EXCEPTIONAn exception has been thrown on the callee node. The exception filed of ResultObject will point to the exception. The exception was either thrown by the callee method, or generated by the Core. See Section 8.4.2.1, “Exceptions Thrown By Callee” for information about user exception remapping.
STATE_CANCELLEDThe call has been cancelled, either by the cancel() method or by the Core.

Initial value of state is STATE_UNKNOWN. When information about call results is delivered back to the ResultObject, the state will change to a different value. Its value will never change afterwards.

[Note]Note

The enumeration type State is member of the ResultObject class, so the fully-qualified name of STATE_SUCCESS is Massiv::Core::ResultObject::STATE_SUCCESS for example.

Method cancel()

Call this method to try to cancel pending remote call.

[Warning]Warning

This method does not guarantee that the call will be cancelled. It will be able to cancel the call only if the request has not migrated to the callee node yet.

Method create_results()

This method creates structure containing the results of the remote method call. The call state must be STATE_SUCCESS. The results are stored in a MethodPacket object (described below), the callee is responsible for its destructrion.