Exemplo n.º 1
0
        private void UpdateTimer()
        {
            int timerIntervalInSeconds = TimerIntervalInSeconds;

            lock (this)
            {
                if ((int)viewRefreshTimer.Period.TotalSeconds == timerIntervalInSeconds)
                {
                    return;
                }

                viewRefreshTimer.Stop();
                viewRefreshTimer = new PeriodicTimer(RefreshReadAndWriteViewsFromBlobs, TimeSpan.FromSeconds(timerIntervalInSeconds));
            }
        }
        public ReplicatedTableConfigurationService(List <ConfigurationStoreLocationInfo> blobLocations,
                                                   bool useHttps,
                                                   int lockTimeoutInSeconds = 0)
        {
            this.blobLocations        = blobLocations;
            this.useHttps             = useHttps;
            this.lastViewRefreshTime  = DateTime.MinValue;
            this.lastRenewedReadView  = new View();
            this.lastRenewedWriteView = new View();
            this.LockTimeout          = TimeSpan.FromSeconds(lockTimeoutInSeconds == 0 ? Constants.LockTimeoutInSeconds : lockTimeoutInSeconds);
            this.Initialize();

            this.viewRefreshTimer = new PeriodicTimer(RefreshReadAndWriteViewsFromBlobs,
                                                      TimeSpan.FromSeconds(Constants.LeaseRenewalIntervalInSec));
        }
        protected internal ReplicatedTableConfigurationManager(
                                    List<ConfigurationStoreLocationInfo> blobLocations,
                                    Dictionary<string, SecureString> connectionStringMap,
                                    bool useHttps,
                                    int lockTimeoutInSeconds,
                                    IReplicatedTableConfigurationParser blobParser)
        {
            this.blobLocations = blobLocations;
            this.ConnectionStrings = connectionStringMap;
            this.useHttps = useHttps;
            this.LockTimeout = TimeSpan.FromSeconds(lockTimeoutInSeconds == 0 ? Constants.LockTimeoutInSeconds : lockTimeoutInSeconds);
            this.LeaseDuration = TimeSpan.FromSeconds(Constants.LeaseRenewalIntervalInSec);

            this.Initialize();

            this.blobParser = blobParser;

            /* IMPORTANT:
             * It is wrong to get a call-back before Constructor finishes !
             * For that, Timer has to be DISABLED initially.
             */
            viewRefreshTimer = new PeriodicTimer(RefreshReadAndWriteViewsFromBlobs, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromSeconds(TimerIntervalInSeconds));
        }
Exemplo n.º 4
0
        internal protected ReplicatedTableConfigurationManager(
            List <ConfigurationStoreLocationInfo> blobLocations,
            Dictionary <string, SecureString> connectionStringMap,
            bool useHttps,
            int lockTimeoutInSeconds,
            IReplicatedTableConfigurationParser blobParser)
        {
            this.blobLocations     = blobLocations;
            this.ConnectionStrings = connectionStringMap;
            this.useHttps          = useHttps;
            this.LockTimeout       = TimeSpan.FromSeconds(lockTimeoutInSeconds == 0 ? Constants.LockTimeoutInSeconds : lockTimeoutInSeconds);
            this.LeaseDuration     = TimeSpan.FromSeconds(Constants.LeaseRenewalIntervalInSec);

            this.Initialize();

            this.blobParser = blobParser;

            /* IMPORTANT:
             * It is wrong to get a call-back before Constructor finishes !
             * For that, Timer has to be DISABLED initially.
             */
            viewRefreshTimer = new PeriodicTimer(RefreshReadAndWriteViewsFromBlobs, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromSeconds(TimerIntervalInSeconds));
        }
        private void UpdateTimer()
        {
            int timerIntervalInSeconds = TimerIntervalInSeconds;

            lock (this)
            {
                if ((int) viewRefreshTimer.Period.TotalSeconds == timerIntervalInSeconds)
                {
                    return;
                }

                viewRefreshTimer.Stop();
                viewRefreshTimer = new PeriodicTimer(RefreshReadAndWriteViewsFromBlobs, TimeSpan.FromSeconds(timerIntervalInSeconds));
            }
        }