RmiCaller

RmiCaller is implemented by the cxRmi framework in order to support a stub for making both synchronous and asynchronous remote method calls.


$adt+ RmiCaller
{
    void SetHandler(IRmiCallerHandler* h);
    void Mark();
    void Wait();
    void MarkAndWait();
    bool ReachedMark() const;
    template <typename I> ptr<I> GetStub();
    void Flush();
    void AbortWaitProducer();
    void WaitProducer(ssize_t bufferSize);
};


void SetHandler(IRmiCallerHandler* h)

Set the IRmiCallerHandler handler for a callback that there is more to send for throttling the producer.


void Mark()

Mark the position up to which we want to ensure we have received all responses for two-way messages.


void Wait()

Wait for responses of two-way messages up to the last call to Mark().

Throws StreamClosedException if RmiCaller closed while the calling thread blocked on this call.


void MarkAndWait()

For convenience combines calls to Mark() and Wait()


bool ReachedMark() const

Returns true if all the responses for the previously set mark have been received. Used for polling.


template <typename I> ptr<I> GetStub()

Retrieve the stub to be used to send messages. Interface I must correspond to the interface provided in the call to CreateRmiCaller<I>() which was used to create the RmiCaller.


void Flush()

Asynchronously flush the outgoing messages


void AbortWaitProducer()

Required if there are calls to WaitProducer(). Should be called exactly once at the time the connection is being closed in order to ensure a thread blocking on WaitProducer() is unblocked.


void WaitProducer(ssize_t bufferSize)

For throttle control on the RmiCaller which represents a producer of buffered messages. This makes the calling thread block until the number of buffered bytes is less than or equal to 'bufferSize'. Note that we are only referring to the buffering messages by the RmiCaller and not by the TCP/IP implementation in the operating system.

The implementation assumes Flush() has already been called as appropriate - otherwise there is a risk of this function waiting indefinately.