Beispiel #1
0
 /// <summary>Create a new KMSAudit.</summary>
 /// <param name="windowMs">
 /// Duplicate events within the aggregation window are quashed
 /// to reduce log traffic. A single message for aggregated
 /// events is printed at the end of the window, along with a
 /// count of the number of aggregated events.
 /// </param>
 internal KMSAudit(long windowMs)
 {
     cache = CacheBuilder.NewBuilder().ExpireAfterWrite(windowMs, TimeUnit.Milliseconds
                                                        ).RemovalListener(new _RemovalListener_118(this)).Build();
     executor = Executors.NewScheduledThreadPool(1, new ThreadFactoryBuilder().SetDaemon
                                                     (true).SetNameFormat(KmsLoggerName + "_thread").Build());
     executor.ScheduleAtFixedRate(new _Runnable_132(this), windowMs / 10, windowMs / 10
                                  , TimeUnit.Milliseconds);
 }
Beispiel #2
0
 public virtual void StartReloader()
 {
     lock (this)
     {
         if (executorService == null)
         {
             executorService = Executors.NewScheduledThreadPool(1);
             executorService.ScheduleAtFixedRate(this, ReloaderSleepMillis, ReloaderSleepMillis
                                                 , TimeUnit.Milliseconds);
         }
     }
 }
 /// <summary>Starts the scheduler for the rollover to run at an interval.</summary>
 /// <param name="initialDelay">The initial delay in the rollover in milliseconds</param>
 /// <param name="period">The interval for the rollover in milliseconds</param>
 protected internal virtual void StartScheduler(long initialDelay, long period)
 {
     lock (this)
     {
         if (!schedulerRunning)
         {
             schedulerRunning = true;
             scheduler        = Executors.NewSingleThreadScheduledExecutor();
             scheduler.ScheduleAtFixedRate(new _Runnable_94(this), initialDelay, period, TimeUnit
                                           .Milliseconds);
         }
     }
 }
Beispiel #4
0
        /// <summary>Start the decommission monitor thread.</summary>
        /// <param name="conf"/>
        internal virtual void Activate(Configuration conf)
        {
            int intervalSecs = conf.GetInt(DFSConfigKeys.DfsNamenodeDecommissionIntervalKey,
                                           DFSConfigKeys.DfsNamenodeDecommissionIntervalDefault);

            Preconditions.CheckArgument(intervalSecs >= 0, "Cannot set a negative " + "value for "
                                        + DFSConfigKeys.DfsNamenodeDecommissionIntervalKey);
            // By default, the new configuration key overrides the deprecated one.
            // No # node limit is set.
            int blocksPerInterval = conf.GetInt(DFSConfigKeys.DfsNamenodeDecommissionBlocksPerIntervalKey
                                                , DFSConfigKeys.DfsNamenodeDecommissionBlocksPerIntervalDefault);
            int nodesPerInterval = int.MaxValue;
            // If the expected key isn't present and the deprecated one is,
            // use the deprecated one into the new one. This overrides the
            // default.
            //
            // Also print a deprecation warning.
            string deprecatedKey = "dfs.namenode.decommission.nodes.per.interval";
            string strNodes      = conf.Get(deprecatedKey);

            if (strNodes != null)
            {
                nodesPerInterval  = System.Convert.ToInt32(strNodes);
                blocksPerInterval = int.MaxValue;
                Log.Warn("Using deprecated configuration key {} value of {}.", deprecatedKey, nodesPerInterval
                         );
                Log.Warn("Please update your configuration to use {} instead.", DFSConfigKeys.DfsNamenodeDecommissionBlocksPerIntervalKey
                         );
            }
            Preconditions.CheckArgument(blocksPerInterval > 0, "Must set a positive value for "
                                        + DFSConfigKeys.DfsNamenodeDecommissionBlocksPerIntervalKey);
            int maxConcurrentTrackedNodes = conf.GetInt(DFSConfigKeys.DfsNamenodeDecommissionMaxConcurrentTrackedNodes
                                                        , DFSConfigKeys.DfsNamenodeDecommissionMaxConcurrentTrackedNodesDefault);

            Preconditions.CheckArgument(maxConcurrentTrackedNodes >= 0, "Cannot set a negative "
                                        + "value for " + DFSConfigKeys.DfsNamenodeDecommissionMaxConcurrentTrackedNodes
                                        );
            monitor = new DecommissionManager.Monitor(this, blocksPerInterval, nodesPerInterval
                                                      , maxConcurrentTrackedNodes);
            executor.ScheduleAtFixedRate(monitor, intervalSecs, intervalSecs, TimeUnit.Seconds
                                         );
            Log.Debug("Activating DecommissionManager with interval {} seconds, " + "{} max blocks per interval, {} max nodes per interval, "
                      + "{} max concurrently tracked nodes.", intervalSecs, blocksPerInterval, nodesPerInterval
                      , maxConcurrentTrackedNodes);
        }
Beispiel #5
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceStart()
        {
            if (!WriteGlobalCleanerPidFile())
            {
                throw new YarnException("The global cleaner pid file already exists! " + "It appears there is another CleanerService running in the cluster"
                                        );
            }
            this.metrics = CleanerMetrics.GetInstance();
            // Start dependent services (i.e. AppChecker)
            base.ServiceStart();
            Runnable task            = CleanerTask.Create(conf, store, metrics, cleanerTaskLock);
            long     periodInMinutes = GetPeriod(conf);

            scheduledExecutor.ScheduleAtFixedRate(task, GetInitialDelay(conf), periodInMinutes
                                                  , TimeUnit.Minutes);
            Log.Info("Scheduled the shared cache cleaner task to run every " + periodInMinutes
                     + " minutes.");
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
//ORIGINAL LINE: public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
            public virtual ScheduledFuture <?> ScheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
            {
                return(e.ScheduleAtFixedRate(command, initialDelay, period, unit));
            }