The call back object for the Put and Get AMI. More...
#include <DM_Client.h>
Public Member Functions | |
PNGCallback (Synchronizer_Helper &sync_helper, int num_msgs) | |
The sync_helper and the max num of msgs to track. | |
~PNGCallback () | |
bool | wait_till_done (int msg_id) |
Wait till the server responds to msg with id msg_id. | |
void | set_done (int msg_id, bool status) |
set or clear the status flag for a particular msg_id | |
int | num_synchs () |
Provides the number of completed AMI callbacks. | |
void | finished (const Ice::AsyncResultPtr &r) |
The call back object for the Put and Get AMI.
Ice calls the finished method once the AMI completes. The client is not tied to any particular call back. The actual call back is provided by a helper class, the sync_helper whose end method is called to complete the full AMI call.
This call back class also doubles up as a rate limiter implementing a sliding window mechanism for sending messages to the server.
Given a max number of msgs, it creates an array to track the status of the msgs that have been sent to the server
It provides a monitor based wait mechanism for the client which can wait till the server responds back to a particular msg. We take the liberty of making a fcfs assumption on the server side processing for keeping things simple.
PNGCallback::PNGCallback | ( | Synchronizer_Helper & | sync_helper, | |
int | num_msgs | |||
) | [inline] |
The sync_helper and the max num of msgs to track.
PNGCallback::~PNGCallback | ( | ) | [inline] |
void PNGCallback::finished | ( | const Ice::AsyncResultPtr & | r | ) | [inline] |
This method is called by Ice run time when the server responds. We do some bookkeeping and delegate the task of actually completing the AMI by calling sync_helper.end method
int PNGCallback::num_synchs | ( | ) | [inline] |
Provides the number of completed AMI callbacks.
void PNGCallback::set_done | ( | int | msg_id, | |
bool | status | |||
) | [inline] |
set or clear the status flag for a particular msg_id
bool PNGCallback::wait_till_done | ( | int | msg_id | ) | [inline] |
Wait till the server responds to msg with id msg_id.