Example #1
0
 public void Dispose()
 {
     lock (disposeLock)
     {
         if (timer != null)
         {
             timer.Stop();
             timer.Dispose();
             timer = null;
         }
         storage  = null;
         callback = null;
     }
 }
	public ConfigurableCallbackTimer(BerkeleyDbStorage storage, ITimerConfig timerConfig, string name,
			int defaultInterval, ConfigurableCallbackTimerDelegate callback)
		{
			if (timerConfig != null && timerConfig.Enabled)
			{
				this.name = name;
				this.storage = storage;
				this.callback = callback;
				timer = new Timer();
				int interval = timerConfig.Interval;
				if (interval <= 0) interval = defaultInterval;
				timer.Interval = interval;
				timer.Elapsed += timer_Elapsed;
				timer.Enabled = true;
				if (BerkeleyDbStorage.Log.IsInfoEnabled)
				{
					BerkeleyDbStorage.Log.InfoFormat("Initialize() {0} Interval = {1} milliseconds", name, interval);
				}
			}
		}
Example #3
0
 public ConfigurableCallbackTimer(BerkeleyDbStorage storage, ITimerConfig timerConfig, string name,
                                  int defaultInterval, ConfigurableCallbackTimerDelegate callback)
 {
     if (timerConfig != null && timerConfig.Enabled)
     {
         this.name     = name;
         this.storage  = storage;
         this.callback = callback;
         timer         = new Timer();
         int interval = timerConfig.Interval;
         if (interval <= 0)
         {
             interval = defaultInterval;
         }
         timer.Interval = interval;
         timer.Elapsed += timer_Elapsed;
         timer.Enabled  = true;
         if (BerkeleyDbStorage.Log.IsInfoEnabled)
         {
             BerkeleyDbStorage.Log.InfoFormat("Initialize() {0} Interval = {1} milliseconds", name, interval);
         }
     }
 }
		public void Dispose()
		{
			lock (disposeLock)
			{
				if (timer != null)
				{
					timer.Stop();
					timer.Dispose();
					timer = null;
				}
				storage = null;
				callback = null;
			}
		}