Update model of table in GoodData and wait for result
@param $writerId
@param $tableId
@param string $queue
@throws ServerException
@return mixed
512963
public function updateModel($writerId, $tableId, $queue = 'primary')
    {
        $job = $this->updateModelAsync($writerId, $tableId, $queue);
        if (!isset($job['url'])) {
            throw new ServerException('Update model job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT));
        }

        return $this->waitForJob($job['url']);
    }
834706
function(threadId, active, callback) {
                if (active) {
                    if (hasCache && typeof queueDb == 'object') {
                        queueDb.waitQ.where('threadId')
                            .equals(threadId)
                            .and(function(item) {
                                return item.owner == parseInt(userInfo.id);
                            })
                            .toArray()
                            .then(function(waitQueueOnCache) {
                                var uniqueIds = [];

                                for (var i = 0; i < waitQueueOnCache.length; i++) {
                                    uniqueIds.push(waitQueueOnCache[i].uniqueId);
                                }

                                if (uniqueIds.length && chatState) {
                                    sendMessage({
                                        chatMessageVOType: chatMessageVOTypes.GET_HISTORY,
                                        content: {
                                            uniqueIds: uniqueIds
                                        },
                                        subjectId: threadId
                                    }, {
                                        onResult: function(result) {
                                            if (!result.hasError) {
                                                var messageContent = result.result;

                                                /**
                                                 * Delete those messages from wait
                                                 * queue which are already on the
                                                 * server databases
                                                 */
                                                for (var i = 0; i < messageContent.length; i++) {
                                                    for (var j = 0; j < uniqueIds.length; j++) {
                                                        if (uniqueIds[j] == messageContent[i].uniqueId) {
                                                            deleteFromChatWaitQueue(messageContent[i], function() {
                                                            });
                                                            uniqueIds.splice(j, 1);
                                                            waitQueueOnCache.splice(j, 1);
                                                        }
                                                    }
                                                }

                                                /**
                                                 * Delete those messages from wait
                                                 * queue which are in the send
                                                 * queue and are going to be sent
                                                 */
                                                for (var i = 0; i < chatSendQueue.length; i++) {
                                                    for (var j = 0; j < uniqueIds.length; j++) {
                                                        if (uniqueIds[j] == chatSendQueue[i].message.uniqueId) {
                                                            deleteFromChatWaitQueue(chatSendQueue[i].message, function() {
                                                            });
                                                            uniqueIds.splice(j, 1);
                                                            waitQueueOnCache.splice(j, 1);
                                                        }
                                                    }
                                                }

                                                callback && callback(waitQueueOnCache);
                                            }
                                        }
                                    });
                                }
                                else {
                                    callback && callback(waitQueueOnCache);
                                }
                            })
                            .catch(function(error) {
                                fireEvent('error', {
                                    code: error.code,
                                    message: error.message,
                                    error: error
                                });
                            });
                    }
                    else {
                        var uniqueIds = [];

                        for (var i = 0; i < chatWaitQueue.length; i++) {
                            uniqueIds.push(chatWaitQueue[i].uniqueId);
                        }

                        if (uniqueIds.length) {
                            sendMessage({
                                chatMessageVOType: chatMessageVOTypes.GET_HISTORY,
                                content: {
                                    uniqueIds: uniqueIds
                                },
                                subjectId: threadId
                            }, {
                                onResult: function(result) {
                                    if (!result.hasError) {
                                        var messageContent = result.result;

                                        for (var i = 0; i < messageContent.length; i++) {
                                            for (var j = 0; j < uniqueIds.length; j++) {
                                                if (uniqueIds[j] == messageContent[i].uniqueId) {
                                                    uniqueIds.splice(j, 1);
                                                    chatWaitQueue.splice(j, 1);
                                                }
                                            }
                                        }
                                        callback && callback(chatWaitQueue);
                                    }
                                }
                            });
                        }
                        else {
                            callback && callback([]);
                        }
                    }
                }
                else {
                    callback && callback([]);
                }
            }
738999
public function streamRead(Stream $streamRead, string $sql, array $bind = [])
    {
        if ($this->getCountPendingQueue() > 0) {
            throw new QueryException('Queue must be empty, before streamWrite');
        }

        return $this->transport()->streamRead($streamRead, $sql, $bind);
    }
1120000
function(id) {
        var q = queues[id];
        q.finished = true;

        if (q.aborted) {
            var msg = "transaction " + id + " was aborted";
            _fail(id, msg);
            return;
        }

        // execute success callback
        if (q.onSuccess) {
            var sc=q.scope || q.win;
            q.onSuccess.call(sc, _returnData(q));
        }
    }
22996
public function updateType($typeId, $status, Type $type)
    {
        try {
            return $this->innerGateway->updateType($typeId, $status, $type);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1250270
public function uploadTable($writerId, $tableId, $incrementalLoad = null, $queue = 'primary')
    {
        $job = $this->uploadTableAsync($writerId, $tableId, $incrementalLoad, $queue);
        if (!isset($job['url'])) {
            throw new ServerException('Upload table job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT));
        }

        return $this->waitForJob($job['url']);
    }
756264
public DataWriterBuilder<S, D> withWriterId(String writerId) {
    this.writerId = writerId;
    log.debug("withWriterId : {}", this.writerId);
    return this;
  }
42427
public function updateRecord($spaceId, $objectId, $recordId, RecordParameters $parameters)
    {
        $requestData = $this->getDefaultRequestData('json', $parameters->exportToArray());
        $endpoint = vsprintf('projects/%s/spaces/%s/objects/%s/records/%s', [
            $this->getProjectId(),
            $spaceId,
            $objectId,
            $recordId
        ]);

        return $this->sendRequest($endpoint, $requestData, static::HTTP_METHOD_PUT);
    }
74160
public function uploadTableAsync($writerId, $tableId, $incrementalLoad = null, $queue = 'primary')
    {
        return $this->getCommand('UploadTable', [
            'writerId' => $writerId,
            'tableId' => $tableId,
            'incrementalLoad' => $incrementalLoad,
            'queue' => $queue
        ])->execute();
    }
888524
public function updateService($serviceId, $body)
    {
        list($response) = $this->updateServiceWithHttpInfo($serviceId, $body);
        return $response;
    }
936428
public function getSsoLink($writerId, $pid, $email)
    {
        $result = $this->getCommand('GetSSOLink', [
            'writerId' => $writerId,
            'pid' => $pid,
            'email' => $email
        ])->execute();
        if (!isset($result['ssoLink'])) {
            throw new ClientException('Getting SSO link failed. ' . (isset($result['error']) ? $result['error'] : ''));
        }
        return $result['ssoLink'];
    }
1074485
public static void write(BufferedWriter writer, DatabaseFieldConfig config, String tableName) throws SQLException {
		try {
			writeConfig(writer, config, tableName);
		} catch (IOException e) {
			throw SqlExceptionUtil.create("Could not write config to writer", e);
		}
	}
1274151
function(id, msg) {

        var q = queues[id], sc;
        if (q.timer) {
            // q.timer.cancel();
            clearTimeout(q.timer);
        }

        // execute failure callback
        if (q.onFailure) {
            sc = q.context || q;
            q.onFailure.call(sc, _returnData(q, msg));
        }

        _end(id, msg, 'failure');
    }
1324729
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull {
        if (!queue.offer(msg)) {
            throw new QueueException.QueueIsFull(getBoundary());
        }
    }
1343521
@Override
  public void update(Result<Integer> result, 
                     int nodeIndex,
                     String sql,
                     Object[] args)
  {
    NodePodAmp node = _podKraken.getNode(nodeIndex);
    
    for (int i = 0; i < node.serverCount(); i++) {
      ServerBartender server = node.server(i);
      
      if (server != null && server.isUp()) {
        ClusterServiceKraken proxy = _podKraken.getProxy(server);
        
        // XXX: failover
        
        proxy.update(result, nodeIndex, sql, args);
        return;
      }
    }

    RuntimeException exn = new ServiceException(L.l("update failed with no live servers"));
    exn.fillInStackTrace();
    
    // XXX: fail
    result.fail(exn);
  }
1020623
void lock(String serverId) {
        Assert.notNull(serverId);
        if (this.locked) {
            throw new IllegalStateException("Cannot lock already locked mutex: " + this);
        }
        this.locked = true;
        this.lockStart = new Date();
        this.lastUpdate = this.lockStart;
        this.serverId = serverId;
    }
63012
public function createWriterWithProject($writerId, $pid, $username, $password, $params = [])
    {
        $job = $this->createWriterWithProjectAsync($writerId, $pid, $username, $password, $params);
        if (!isset($job['url'])) {
            throw new ServerException('Create writer job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT));
        }

        return $this->waitForJob($job['url']);
    }