Batch callback for acknowledgement
3522
function BatchCB (response) {
        console.log ("### Batch SMS CallBack --> Status=%j", response);

        if (response.status === 0 || response.status === -4) {
              console.log ("SMS Batch Test done");
              setTimeout (process.exit, 1000);
        }
    }
1124773
def acknowledge(self, size, msg):
        
        stream = self.router.stream_by_id(msg.src_id)
        state = self._state_by_stream[stream]
        state.lock.acquire()
        try:
            if state.unacked < size:
                LOG.error('%r.acknowledge(src_id %d): unacked=%d < size %d',
                          self, msg.src_id, state.unacked, size)
            state.unacked -= min(state.unacked, size)
            self._schedule_pending_unlocked(state)
        finally:
            state.lock.release()
623341
def add_done_callback(self, fn):  # pylint: disable=invalid-name
        
        if self._operation.done:
            _try_callback(self, fn)
        else:
            self._queue.put(dill.dumps(fn))
            if self._process is None:
                self._process = mp.Process(target=self._execute_tasks)
                self._process.start()
1302008
private CompletableFuture<Void> acknowledge(Void ignored) {
        checkRunning();
        long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "acknowledge");

        long highestCommittedSeqNo = this.ackCalculator.getHighestCommittedSequenceNumber(this.processors.values());
        long ackSequenceNumber = this.dataSource.getClosestValidTruncationPoint(highestCommittedSeqNo);
        if (ackSequenceNumber > this.state.getLastTruncatedSequenceNumber()) {
            // Issue the truncation and update the state (when done).
            return this.dataSource
                    .acknowledge(ackSequenceNumber, this.config.getAckTimeout())
                    .thenRun(() -> {
                        this.state.setLastTruncatedSequenceNumber(ackSequenceNumber);
                        logStageEvent("Acknowledged", "SeqNo=" + ackSequenceNumber);
                        LoggerHelpers.traceLeave(log, this.traceObjectId, "acknowledge", traceId, ackSequenceNumber);
                    });
        } else {
            // Nothing to do.
            LoggerHelpers.traceLeave(log, this.traceObjectId, "acknowledge", traceId, Operation.NO_SEQUENCE_NUMBER);
            return CompletableFuture.completedFuture(null);
        }
    }
1044362
def cmd_echo(self, connection, sender, target, payload):
        
        connection.privmsg(target, payload or "Hello, {0}".format(sender))
224361
def batch_help():
    

    message = m.Message()
    message.add(m.Brand())
    message.add(heading())
    message.add(content())
    return message
171744
def signal_handler(self, *args):
        
        self.user_callback(self.signal, self.user_arg, *args)
798981
def msg_callback(self, callback):
        """"""
        if callable(callback):
            self._msg_callback = callback
        else:
            self._msg_callback = None
1311968
function BatchResponseCB (data) {
    switch (data.status ) {
        case -1: console.log (" SMS -%d- Fail to Send SMS", data.smsid);
            break;
        case -2: console.log (" SMS -%d- Timeout waiting acknowledgement", data.smsid);
            break;
        case 1: console.log (" SMS -%d- Message Sent", data.smsid);
            break;
        case 2: console.log (" SMS -%d- Acknowledgement=[%s]", data.smsid, data.msg.ack);
            break;
        default:
    }
    // quit except if we wait for ack [leave some time to DB to close operation]
    if (data.status === 0) {
        console.log ('Last SMS from batch processed');
        setTimeout(process.exit, 1000);
    }
}
731383
function callbackWrapper() {
					callback && callback.apply( this, arguments );

					// Removed the just loaded script from the queue.
					pending.shift();

					loadNext.call( that );
				}
1018127
def execute_callback(name, *args)
      return unless respond_to?(name)

      unless arity_cache.key?(name)
        arity_cache[name] = method(name).arity
      end

      if arity_cache[name] == 0
        send(name)
      else
        send(name, *args)
      end
    end
1191130
function sayHello(call, callback) {
  var reply = new messages.HelloReply();
  reply.setMessage('Hello ' + call.request.getName());
  callback(null, reply);
}
53457
function callbackOnce(err, arg) {
            var cb = callback;
            callback = null;
            if (cb) { cb(err, arg); }
        }
1304182
def trigger_callback(self, sid, namespace, id, data):
        """"""
        callback = None
        try:
            callback = self.callbacks[sid][namespace][id]
        except KeyError:
            # if we get an unknown callback we just ignore it
            self._get_logger().warning('Unknown callback received, ignoring.')
        else:
            del self.callbacks[sid][namespace][id]
        if callback is not None:
            callback(*data)
563621
function batchCmd(cmdArray, callback){

        var requestJson = [];

        for (var i = 0; i < cmdArray.length; i++){
            requestJson.push({
                method: cmdArray[i][0],
                params: cmdArray[i][1],
                id: Date.now() + Math.floor(Math.random() * 10) + i
            });
        }

        var serializedRequest = JSON.stringify(requestJson);

        performHttpRequest(instances[0], serializedRequest, function(error, result){
            callback(error, result);
        });

    }
81349
def raise_acknowledge_log_entry(self):
        
        if not self.__class__.log_acknowledgements:
            return

        brok = make_monitoring_log(
            'info', "HOST ACKNOWLEDGE ALERT: %s;STARTED; "
                    "Host problem has been acknowledged" % self.get_name()
        )
        self.broks.append(brok)
1362964
def _do_callbacks(self):
        """"""
        self._done = False

        while self._callbacks and not self._cancelled:
            cb, eb, cb_args, cb_kwargs, eb_args, eb_kwargs = self._callbacks.pop()
            if cb and not self._exception:
                try:
                    self._result = cb(self._result, *cb_args, **cb_kwargs)
                    self._exception = False
                except Exception as e:
                    #logger.exception('deferred got exception while doing callback')
                    self._exception = True
                    self._result = e
                    self._tb_info = ''.join(traceback.format_tb(sys.exc_info()[2]))
            elif eb and self._exception:
                try:
                    self._result = eb(self._result, *eb_args, **eb_kwargs)
                    self._exception = False
                except Exception as e:
                    #logger.exception('deferred got exception while doing callback')
                    self._exception = True
                    self._result = e
                    self._tb_info = ''.join(traceback.format_tb(sys.exc_info()[2]))


        if self._exception:
            if Deferred.warnings:
                logger.warn('Unhandled Exception: ' + str(self._result))
            self._last_exception.exception = self._result
            self._last_exception.tb_info = self._tb_info
        else:
            self._last_exception.exception = None
            self._last_exception.tb_info = None

        self._done = True