private void CreateSnapshotTaker(PrevalenceEngine engine, float snapshotPeriod)
        {
            TimeSpan       period = TimeSpan.FromHours(snapshotPeriod);
            ICleanUpPolicy policy = (ICleanUpPolicy)Kernel[PrevalenceFacility.CleanupPolicyComponentPropertyKey];

            SnapshotTaker taker = new SnapshotTaker(engine, period, policy);

            Kernel.AddComponentInstance(PrevalenceFacility.SnapShotTakerComponentPropertyKey, taker);
        }
		/// <summary>
		/// Creates a new SnapshotTaker for the PrevalenceEngine engine
		/// with a period between snapshots equals to period. Files
		/// will be removed according to the specified cleanUpPolicy object.
		/// </summary>
		/// <param name="engine">prevalence engine to take snapshots from</param>
		/// <param name="period">period between snapshots</param>
		/// <param name="cleanUpPolicy">clean up policy</param>
		public SnapshotTaker(PrevalenceEngine engine, TimeSpan period, ICleanUpPolicy cleanUpPolicy)
		{
			if (null == engine)
			{
				throw new ArgumentNullException("engine");
			}			

			if (null == cleanUpPolicy)
			{
				throw new ArgumentNullException("cleanUpPolicy");
			}

			_cleanUpPolicy = cleanUpPolicy;
			_timer = new Timer(new TimerCallback(OnTimer), engine, period, period);			
		}
Beispiel #3
0
        /// <summary>
        /// Creates a new SnapshotTaker for the PrevalenceEngine engine
        /// with a period between snapshots equals to period. Files
        /// will be removed according to the specified cleanUpPolicy object.
        /// </summary>
        /// <param name="engine">prevalence engine to take snapshots from</param>
        /// <param name="period">period between snapshots</param>
        /// <param name="cleanUpPolicy">clean up policy</param>
        public SnapshotTaker(PrevalenceEngine engine, TimeSpan period, ICleanUpPolicy cleanUpPolicy)
        {
            if (null == engine)
            {
                throw new ArgumentNullException("engine");
            }

            if (null == cleanUpPolicy)
            {
                throw new ArgumentNullException("cleanUpPolicy");
            }

            _cleanUpPolicy = cleanUpPolicy;
            _timer         = new Timer(new TimerCallback(OnTimer), engine, period, period);
        }