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); } }
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)); } }
public Service(ServiceDelegate service, BehaviorTask child) : base(child) { this.ServiceMethod = service; }
public Service(int interval, ServiceDelegate service, BehaviorTask child) : this(service, child) { this.interval = interval; }