public final void WindUpTask() { _ncacheLog.CriticalInfo("DSAsyncUpdatesProcessor", "WindUp Task Started."); if (_updateQueue != null) { _ncacheLog.CriticalInfo( "DSAsyncUpdatesProcessor", "Update processor Queue Count: " + _updateQueue.getCount()); } _shutdownStatusLatch.SetStatusBit(ShutDownStatus.SHUTDOWN_INPROGRESS, ShutDownStatus.NONE); synchronized (this) { com.alachisoft.tayzgrid.common.threading.Monitor.pulse(this); } _ncacheLog.CriticalInfo("DSAsyncUpdatesProcessor", "WindUp Task Ended."); }
/** Thread function, keeps running. */ protected final void Run() { while (this._worker != null && !this._isDisposing) { WriteOperation operation = null; try { synchronized (this) { if (this._updateQueue.getCount() < 1) { if (_shutdownStatusLatch.IsAnyBitsSet(ShutDownStatus.SHUTDOWN_INPROGRESS)) { _shutdownStatusLatch.SetStatusBit( ShutDownStatus.SHUTDOWN_COMPLETED, ShutDownStatus.SHUTDOWN_INPROGRESS); return; } com.alachisoft.tayzgrid.common.threading.Monitor.wait(this); } if (this._updateQueue.getCount() > 0) { operation = this._updateQueue.Dequeue(); } else if (_updateQueue.getCount() == 0 && _shutdownStatusLatch.IsAnyBitsSet(ShutDownStatus.SHUTDOWN_INPROGRESS)) { break; } } if (operation == null) { continue; } synchronized (_processMutex) { if (!_isDisposing) { if (_dsMgr != null) { _dsMgr.DSAsyncUpdateInCache(operation); } } } } catch (InterruptedException e) { break; } catch (Exception e) { } } }
public final void WaitForShutDown(long interval) { _ncacheLog.CriticalInfo("DSAsyncUpdatesProcessor", "Waiting for shutdown task completion."); if (_updateQueue.getCount() > 0) { _shutdownStatusLatch.WaitForAny(ShutDownStatus.SHUTDOWN_COMPLETED, interval * 1000); } if (_updateQueue != null && _updateQueue.getCount() > 0) { _ncacheLog.CriticalInfo( "DSAsyncUpdatesProcessor", "Remaining update processor queue operations: " + _updateQueue.getCount()); } _ncacheLog.CriticalInfo("DSAsyncUpdatesProcessor", "Shutdown task completed."); }