Search in sources :

Example 1 with RpcRequest

use of im.actor.core.network.mtp.entity.rpc.RpcRequest in project actor-platform by actorapp.

the class ApiBroker method performRequest.

private void performRequest(long randomId, Request message, RpcCallback callback, long timeout) {
    Log.d(TAG, "-> request#" + randomId + ": " + message);
    // Log.d(TAG, message + " rid#" + randomId);
    RequestHolder holder = new RequestHolder(Runtime.getCurrentTime(), randomId, new RpcRequest(message.getHeaderKey(), message.toByteArray()), callback);
    requests.put(holder.publicId, holder);
    if (proto != null) {
        long mid = proto.sendRpcMessage(holder.message);
        holder.protoId = mid;
        idMap.put(mid, randomId);
    // Log.d(TAG, message + " rid#" + randomId + " <- mid#" + mid);
    }
    if (timeout > 0) {
        CommonTimer commonTimer = new CommonTimer(new TimeoutTask(holder.publicId));
        timeouts.put(holder.publicId, commonTimer);
        commonTimer.schedule(timeout);
    }
}
Also used : RpcRequest(im.actor.core.network.mtp.entity.rpc.RpcRequest) CommonTimer(im.actor.runtime.threading.CommonTimer)

Aggregations

RpcRequest (im.actor.core.network.mtp.entity.rpc.RpcRequest)1 CommonTimer (im.actor.runtime.threading.CommonTimer)1