コード例 #1
0
 public override bool HandleTaskRequest(RequestObjectMessage container, BaseRequestObject requestObject)
 {
     var request = (RequestObject)requestObject;
     request.Return = -request.RequestId;
     if (BatchSize == 1) Interlocked.Increment(ref _callsCount);
     Thread.Sleep(_waitTimeMs);
     return true;
 }
コード例 #2
0
ファイル: MainHandler.cs プロジェクト: kendarorg/ZakFramework
 public long DoRequestAndWait(BaseRequestObject requestObject, int timeoutMs, string senderId = null)
 {
     if (requestObject == null) throw new ArgumentNullException("requestObject");
     if (timeoutMs < 0) throw new ArgumentException("Parameter must be greater than 0", "timeoutMs");
     var msg = new RequestObjectMessage(requestObject, timeoutMs) { SourceThread = senderId };
     SendMessageToThread(msg);
     var sw = new Stopwatch();
     sw.Start();
     msg.Wait();
     sw.Stop();
     return sw.ElapsedMilliseconds;
 }
コード例 #3
0
ファイル: MainHandler.cs プロジェクト: kendarorg/ZakFramework
 public abstract bool HandleTaskRequest(RequestObjectMessage container, BaseRequestObject requestObject);
コード例 #4
0
ファイル: MainHandler.cs プロジェクト: kendarorg/ZakFramework
        public void FireAndForget(BaseRequestObject requestObject, int timeoutMs, string senderId = null)
        {
            if (requestObject == null) throw new ArgumentNullException("requestObject");
            if (timeoutMs < 0) throw new ArgumentException("Parameter must be greater than 0", "timeoutMs");

            var msg = new RequestObjectMessage(requestObject, timeoutMs) { SourceThread = senderId };
            SendMessageToThread(msg);
        }