//[OgreVersion(1, 7, 2)] protected RequestID AddRequest(ResourceRequest req) { WorkQueue queue = Root_Instance_WorkQueue; RequestID requestID = queue.AddRequest(this.workQueueChannel, (ushort)req.Type, req); this.outstandingRequestSet.Add(requestID); return(requestID); }
/// <summary> /// Constructor /// </summary> ////[OgreVersion(1, 7, 2)] public Request(ushort channel, ushort rtype, object rData, byte retry, RequestID rid) { this._channel = channel; this._type = rtype; this._data = rData; this._retryCount = retry; this._id = rid; this._aborted = false; }
public override void AbortRequest(RequestID id) { // NOTE: Pending requests are exist any of RequestQueue, ProcessQueue and // ResponseQueue when keeping ProcessMutex, so we check all of these queues. lock ( processMutex ) { foreach (var i in this.processQueue) { if (i.ID == id) { i.AbortRequest(); break; } } } lock ( requestMutex ) { foreach (var i in this.requestQueue) { if (i.ID == id) { i.AbortRequest(); break; } } } lock ( responseMutex ) { foreach (var i in this.responseQueue) { if (i.Request.ID == id) { i.AbortRequest(); break; } } } }
/// <summary> /// Put a Request on the queue with a specific RequestID. /// </summary> //[OgreVersion(1, 7, 2)] protected void AddRequestWithRID(RequestID rid, ushort channel, ushort requestType, object rData, byte retryCount) { // lock to push request to the queue lock (requestMutex) { if (this.shuttingDown) { return; } var req = new Request(channel, requestType, rData, retryCount, rid); LogManager.Instance.Write(LogMessageLevel.Trivial, false, "DefaultWorkQueueBase('{0}') - REQUEUED(thread:{1}): ID={2} channel={3} requestType={4}", this.name, GetThreadName(), rid, channel, requestType); #if AXIOM_THREAD_SUPPORT requestQueue.Add(req); NotifyWorkers(); #else ProcessRequestResponse(req, true); #endif } }
/// <see cref="WorkQueue.AbortRequest"/> //[OgreVersion(1, 7, 2)] public override void AbortRequest(RequestID id) { // NOTE: Pending requests are exist any of RequestQueue, ProcessQueue and // ResponseQueue when keeping ProcessMutex, so we check all of these queues. lock (processMutex) { foreach (var i in this.processQueue) { if (i.ID == id) { i.AbortRequest(); break; } } } lock (requestMutex) { foreach (var i in this.requestQueue) { if (i.ID == id) { i.AbortRequest(); break; } } } lock (responseMutex) { foreach (var i in this.responseQueue) { if (i.Request.ID == id) { i.AbortRequest(); break; } } } }
/// <summary> /// Put a Request on the queue with a specific RequestID. /// </summary> //[OgreVersion(1, 7, 2)] protected void AddRequestWithRID(RequestID rid, ushort channel, ushort requestType, object rData, byte retryCount) { // lock to push request to the queue lock (requestMutex) { if (this.shuttingDown) { return; } var req = new Request(channel, requestType, rData, retryCount, rid); LogManager.Instance.Write(LogMessageLevel.Trivial, false, "DefaultWorkQueueBase('{0}') - REQUEUED(thread:{1}): ID={2} channel={3} requestType={4}", this.name, GetThreadName(), rid, channel, requestType); #if AXIOM_THREAD_SUPPORT requestQueue.Add( req ); NotifyWorkers(); #else ProcessRequestResponse(req, true); #endif } }
public abstract void AbortRequest( RequestID id );
public Request( ushort channel, ushort rtype, object rData, byte retry, RequestID rid ) { this._channel = channel; this._type = rtype; this._data = rData; this._retryCount = retry; this._id = rid; this._aborted = false; }
/// <summary> /// Aborts background process. /// </summary> //[OgreVersion(1, 7, 2)] public void AbortRequest(RequestID ticket) { WorkQueue queue = Root_Instance_WorkQueue; queue.AbortRequest(ticket); }
/// <summary> /// Returns whether a previously queued process has completed or not. /// </summary> /// <remarks> /// This method of checking that a background process has completed is /// the 'polling' approach. Each queued method takes an optional listener /// parameter to allow you to register a callback instead, which is /// arguably more efficient. /// @note /// Tickets are not stored once complete so do not accumulate over time. /// This is why a non-existent ticket will return 'true'. /// </remarks> /// <param name="ticket">The ticket which was returned when the process was queued</param> /// <returns>true if process has completed (or if the ticket is unrecognised), false otherwise</returns> //[OgreVersion(1, 7, 2)] public virtual bool IsProcessComplete(RequestID ticket) { return(!this.outstandingRequestSet.Contains(ticket)); }
/// <summary> /// Abort a previously issued request. /// If the request is still waiting to be processed, it will be /// removed from the queue. /// </summary> /// <param name="id">The ID of the previously issued request.</param> ////[OgreVersion(1, 7, 2)] public abstract void AbortRequest(RequestID id);