///////////////////////////////////////////////////////////////////////////////////////////// #region // Public Methods /// <summary> /// Waits for an incoming message, then executes the corresponding operation and transmits a response. /// </summary> public override void ProcessRequest(IOperationMap operationMap) { var request = this.protocol.Receive(this.encoder); request = this.ValidateRequest(request); var response = operationMap.Execute(request); this.protocol.Send(response, this.encoder); }
///////////////////////////////////////////////////////////////////////////////////////////// #region // Public Methods /// <summary> /// Waits for an incoming message, then executes the corresponding operation concurrently. /// Once the operation completes, it transmits a response back. /// </summary> public override void ProcessRequest(IOperationMap operationMap) { while (true) // FIX THIS { var request = this.protocol.Receive(this.encoder); var t = Task.Factory.StartNew(() => { var req = this.ValidateRequest(request); var response = operationMap.Execute(req); lock (this.protocol) { this.protocol.Send(response, this.encoder); } } ); } }
///////////////////////////////////////////////////////////////////////////////////////////// #region // Public Methods /// <summary> /// Template method for processing requests by the SpaceRepository executing the requested action. /// </summary> public abstract void ProcessRequest(IOperationMap operationMap);
///////////////////////////////////////////////////////////////////////////////////////////// #region // Constructors /// <summary> /// Initializes a new instance of the SpaceRepository class. /// </summary> public SpaceRepository() : base() { this.operationMap = new OperationMap(this); }
///////////////////////////////////////////////////////////////////////////////////////////// #region // Public Methods /// <summary> /// Not implemented. /// </summary> public override void ProcessRequest(IOperationMap operationMap) { }