Received an ACK for a remote Task.  Ping the task.
511009
AutoBuffer call(AutoBuffer ab) {
    int tnum = ab.getTask();
    RPC<?> t = ab._h2o.taskGet(tnum);
    assert t== null || t._tasknum == tnum;
    if( t != null ) t.response(ab); // Do the 2nd half of this task, includes ACKACK
    else ab.close();
    // Else forgotten task, but still must ACKACK
    return new AutoBuffer(ab._h2o).putTask(UDP.udp.ackack.ordinal(),tnum);
  }
683555
def task_wait(meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code):
    
    task_wait_with_io(
        meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code
    )
861154
def send_command_ack(self, device_id, action):
        """"""
        # serialize commands
        yield from self._ready_to_send.acquire()
        acknowledgement = None
        try:
            self._command_ack.clear()
            self.send_command(device_id, action)

            log.debug('waiting for acknowledgement')
            try:
                yield from asyncio.wait_for(self._command_ack.wait(),
                                            TIMEOUT.seconds, loop=self.loop)
                log.debug('packet acknowledged')
            except concurrent.futures._base.TimeoutError:
                acknowledgement = {'ok': False, 'message': 'timeout'}
                log.warning('acknowledge timeout')
            else:
                acknowledgement = self._last_ack.get('ok', False)
        finally:
            # allow next command
            self._ready_to_send.release()

        return acknowledgement
1188631
def echo(bot, update):
    """"""
    message = update.get_effective_message()
    bot.reply(update, message)
1012010
def ping(self):
        

        # Make sure we're connected
        if not self.conn:
            self.connect()

        # Send the ping and wait for the response
        self.conn.send('PING', time.time())
        cmd, payload = self.conn.recv()
        recv_ts = time.time()

        # Make sure the response was a PONG
        if cmd != 'PONG':
            raise Exception("Invalid response from server")

        # Return the RTT
        return recv_ts - payload[0]
1145358
async def receive(self, pkt):
        """"""
        self.server.logger.info('%s: Received packet %s data %s',
                                self.sid, packet.packet_names[pkt.packet_type],
                                pkt.data if not isinstance(pkt.data, bytes)
                                else '<binary>')
        if pkt.packet_type == packet.PING:
            self.last_ping = time.time()
            await self.send(packet.Packet(packet.PONG, pkt.data))
        elif pkt.packet_type == packet.MESSAGE:
            await self.server._trigger_event(
                'message', self.sid, pkt.data,
                run_async=self.server.async_handlers)
        elif pkt.packet_type == packet.UPGRADE:
            await self.send(packet.Packet(packet.NOOP))
        elif pkt.packet_type == packet.CLOSE:
            await self.close(wait=False, abort=True)
        else:
            raise exceptions.UnknownPacketError()
580243
protected void ping(ManagerConnection c)
    {
        try
        {
            if (timeout <= 0)
            {
                c.sendAction(new PingAction(), null);
            }
            else
            {
                final ManagerResponse response;

                response = c.sendAction(new PingAction(), timeout);
                logger.debug("Ping response '" + response + "' for " + c.toString());
            }
        }
        catch (Exception e)
        {
            logger.warn("Exception on sending Ping to " + c.toString(), e);
        }
    }
538284
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword)
    {
        RemoteTask remoteTask = null;
        if (Params.NONE.equalsIgnoreCase(strServer))
            return null;    // No server specified, don't use one.
        try {
            if (strUserID == null)
                strUserID = this.getProperty(Params.USER_ID);
            String strLanguage = this.getLanguage(true);
            Map<String,Object> properties = this.getServerProperties();
            if (strUserID != null)
                properties.put(Params.USER_ID, strUserID);
            if (strLanguage != null)
	            if (strLanguage.length() > 0)
    	            properties.put(Params.LANGUAGE, strLanguage);
            if (properties.get(Params.DOMAIN) == null)
            	if (this.getProperty(Params.DOMAIN) != null)
            		properties.put(Params.DOMAIN, this.getProperty(Params.DOMAIN));
            if (properties.get(Constants.SYSTEM_NAME) == null)
                if (this.getProperty(Constants.SYSTEM_NAME) != null)
                    properties.put(Constants.SYSTEM_NAME, this.getProperty(Constants.SYSTEM_NAME));
            if (m_mainRemoteTask == null)
            {
                ApplicationServer appServer = null;
                int iConnectionType = getConnectionType();
                if (iConnectionType == PROXY)
                {   // Use HTTP proxy instead of RMI
                    String strBaseServletPath = this.getBaseServletPath();
                    appServer = new ApplicationProxy(strServer, strBaseServletPath, strRemoteApp);
                }
                if (iConnectionType == LOCAL_SERVICE)
                {   // Use local OSGi service instead of RMI
                    if ((strRemoteApp == null) || (strRemoteApp.indexOf('.') == -1))
                        strRemoteApp = Params.DEFAULT_REMOTE_APP;
                    // WARNING: This may take a while, so don't run this in your main thread.
                	appServer = (ApplicationServer)ClassServiceUtility.getClassService().getClassFinder(null).getClassBundleService(null, strRemoteApp, null, null, -1);
                }
                if (appServer == null)
                {
                    Util.getLogger().log(Level.SEVERE, "Remote server " + strRemoteApp + " did not come up");
                    return null;
                }
                remoteTask = appServer.createRemoteTask(properties);
                m_mainRemoteTask = remoteTask;
            }
            else
            {
                remoteTask = m_mainRemoteTask.createRemoteTask(properties);
            }
        } catch (RemoteException ex)    {
            ex.printStackTrace();
        }
        return remoteTask;
    }
390407
def handle_agent_tasks(self, task):
        
        logger.debug("Received agent request with messageId: %s" % task["messageId"])
        if "action" in task:
            if task["action"] == "python.source":
                payload = get_py_source(task["args"]["file"])
            else:
                message = "Unrecognized action: %s. An newer Instana package may be required " \
                          "for this. Current version: %s" % (task["action"], package_version())
                payload = {"error": message}
        else:
            payload = {"error": "Instana Python: No action specified in request."}

        self.agent.task_response(task["messageId"], payload)
747282
def request_echo(self, sock, msg):
        """"""
        return katcp.Message.reply(msg.name, "ok", *msg.arguments)
339277
void remove_task_tracking( int task ) {
    RPC.RPCCall rpc = _work.get(task);
    if( rpc == null ) return;   // Already stopped tracking

    // Atomically attempt to remove the 'dt'.  If we win, we are the sole
    // thread running the dt.onAckAck.  Also helps GC: the 'dt' is done (sent
    // to client and we received the ACKACK), but the rpc might need to stick
    // around a long time - and the dt might be big.
    DTask dt = rpc._dt;         // The existing DTask, if any
    if( dt != null && RPC.RPCCall.CAS_DT.compareAndSet(rpc,dt,null) ) {
      assert rpc._computed : "Still not done #"+task+" "+dt.getClass()+" from "+rpc._client;
      AckAckTimeOutThread.PENDING.remove(rpc);
      dt.onAckAck();            // One-time call on stop-tracking
    }

    // Roll-up as many done RPCs as we can, into the _removed_task_ids list
    while( true ) {
      int t = _removed_task_ids.get();   // Last already-removed ID
      RPC.RPCCall rpc2 = _work.get(t+1); // RPC of 1st not-removed ID
      if( rpc2 == null || rpc2._dt != null || !_removed_task_ids.compareAndSet(t,t+1) )
        break;                  // Stop when we hit in-progress tasks
      _work.remove(t+1);        // Else we can remove the tracking now
    }
  }
1274464
def _process_ping(self):
        
        yield self.send_command(PONG_PROTO)
        if self._flush_queue.empty():
            yield self._flush_pending()
1024399
public ReceivedMessageTask getTaskToProcess() {
        ReceivedMessageTask task = tasks.peek();
        if (task != null && task.setProcessing()) {
            return task;
        }
        return null;
    }
272332
function ping() {
        result = fn.apply(context || this, args || []);
        context = args = null;
        executed = true;
      }
300475
function interceptTask(task, asyncTeardown) {
    var doneCallback;

    function interceptCallback(err, value) {
        function onTeardown(newErr) {
            doneCallback(err || newErr, value);
        }

        asyncTeardown(onTeardown);
    }

    if (typeof task === 'function') {
        doneCallback = task;
        return interceptCallback;
    } else {
        doneCallback = task.end.bind(task);
        task.end = interceptCallback;
        return task;
    }
}
598562
function isTaskHandled(request, reply) {
        var taskName = request.query.task;

        // if no task or task handler, don't do anything
        if (!taskName && !taskHandlers[taskName]) { return false; }

        // if task info doesn't have service or method, don't do anything
        var taskInfo = taskHandlers[taskName];
        if (!taskInfo || !taskInfo.service || !taskInfo.method || !taskInfo.service[taskInfo.method]) {
            return false;
        }

        // if user is not logged in redirect to login then back to here
        if (!request.caller || !request.caller.user) {
            var currentUrl = request.url.pathname;
            var loginUrl = currentUrl + '?modal=auth&submodal=login&redirect=' + currentUrl;
            reply().redirect(loginUrl);
            return true;
        }

        // start collecting the service request
        var serviceReq = { caller: request.caller };

        // get the values from the request object to put into the service request
        _.each(taskInfo.params, function (param) {
            if (request.query[param]) {
                serviceReq[param] = request.query[param];
            }
        });

        // call the service method
        taskInfo.service[taskInfo.method](serviceReq)
            .then(function () {
                reply().redirect(request.path + '?notify=' + taskInfo.notifySuccess);
            })
            .catch(function (err) {
                log.error(err);
                reply().redirect(request.path + '?notify=' + taskInfo.notifyFailure);
            });

        return true;
    }
176407
def ping(self, callback=None, **kwargs):
        
        self.client.fetch(
            self.mk_req('', method='HEAD', **kwargs),
            callback = callback
        )