Пример #1
0
        private JObject ExecuteMethod(JetMethod method)
        {
            double timeoutMs = method.getTimeoutMs();

            if (timeoutMs < 0.0)
            {
                throw new ArgumentException("timeoutMs");
            }

            if (method.HasResponseCallback())
            {
                int id = method.GetRequestId();
                lock (this.openRequests)
                {
                    method.RequestTimer.Interval = timeoutMs;
                    method.RequestTimer.Elapsed += (sender, e) => RequestTimer_Elapsed(this, e, method);
                    method.RequestTimer.Start();

                    this.openRequests.Add(id, method);
                }
            }

            JObject request = method.GetJson();

            this.connection.SendMessage(JsonConvert.SerializeObject(request));
            return(request);
        }