Exemple #1
0
        private void AddService(ServiceDelegate service)
        {
            lock (self_locker) {
                if (this._destroyed)
                {
                    return;
                }
            }

            this.StartServiceThread();

            lock (service_locker) {
                if (this._serviceCache.Count < 10000)
                {
                    this._serviceCache.Add(service);
                }

                if (this._serviceCache.Count == 9998)
                {
                    ErrorRecorderHolder.recordError(new Exception("Quest Calls Limit!"));
                }
            }

            try {
                this._serviceEvent.Set();
            } catch (Exception ex) {
                ErrorRecorderHolder.recordError(ex);
            }
        }
Exemple #2
0
        public async Task <Response <T> > Execute <TRequestContext, TParam, T>(TRequestContext requestContext,
                                                                               ServiceDelegate <TRequestContext, TParam, T> serviceMethod, TParam parameter) where TRequestContext : RequestContext
        {
            try
            {
                var response = new Response <T>();
                response.Result = await serviceMethod.Invoke(requestContext, parameter);

                return(response);
            }
            catch (Exception ex)
            {
                return(GetErrorResponse <Response <T> >(requestContext, ex));
            }
        }
Exemple #3
0
 public Service(ServiceDelegate service, BehaviorTask child) : base(child)
 {
     this.ServiceMethod = service;
 }
Exemple #4
0
 public Service(int interval, ServiceDelegate service, BehaviorTask child) : this(service, child)
 {
     this.interval = interval;
 }