Esempio n. 1
0
        /// <summary>Update configuration of the current database monitoring storage</summary>
        /// <param name="growType">Type of the growing strategy</param>
        /// <param name="growLimit">Growing limit</param>
        public void UpdateConfiguration(GrowType growType, int growLimit)
        {
            // Stop previous storage queue processing thread.
            _storageQueue.StopProcessing();

            _storageQueue.GrowType  = growType;
            _storageQueue.GrowLimit = growLimit;

            // Start new storage queue processing thread.
            _storageQueue.StartProcessing();
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (GrowType != 0)
            {
                hash ^= GrowType.GetHashCode();
            }
            if (GrowthAdjustment != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(GrowthAdjustment);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 3
0
        public void StartProcessing()
        {
            // Check the processing started flag.
            if (IsProcessing)
            {
                throw new InvalidOperationException(Resources.Strings.AsyncQueueStartError);
            }

            _growType  = GrowType;
            _growLimit = Math.Max(1, GrowLimit);

            // Reset asynchronous queue size.
            Interlocked.Exchange(ref _asyncQueueSize, 0);

            // Initialize processing collections.
            _currentCollection     = new List <T>();
            _processingCollection  = new List <T>();
            _asyncProcessingWaiter = new AutoResetEvent(false);
            _asyncProcessingLocker = new object();

            // Create and start processing thread.
            _asyncProcessingThread = new Thread(ProcessingThreadMethod)
            {
                Name         = Name,
                IsBackground = true,
                Priority     = ThreadPriority.Lowest
            };
            _asyncProcessingThread.Start();

            // Set the processing started flag.
            IsProcessing = true;

            // Reset the overflow error flag.
            IsOverflowError = false;

            // Rise asynchronous processing start event.
            HandleStart();
        }
Esempio n. 4
0
 /// <summary>
 /// Create instance of the asynchronous queue (hot swap version).
 /// </summary>
 /// <param name="name">Name of the asynchronous queue</param>
 /// <param name="growType">Type of the growing strategy</param>
 /// <param name="growLimit">Growing limit</param>
 public AsyncQueueHotSwap(string name, GrowType growType = GrowType.Error, int growLimit = 1000000)
 {
     Name      = name;
     GrowType  = growType;
     GrowLimit = growLimit;
 }
Esempio n. 5
0
 public GrowLimiter(GrowType growType, int growLimit)
 {
     _growType  = growType;
     _growLimit = growLimit;
 }