Example #1
0
        /// <summary>
        /// Creates a new task progress heartbeat timer with the given parameters.
        /// </summary>
        /// <param name="logger">The logger to append messages to.</param>
        /// <param name="progressFormatMessage">The progress message. Can contain tokens (see class summary).</param>
        /// <param name="pollIntervalSeconds">The number of seconds to wait between heartbeats.</param>
        /// <param name="options">Options as to whether to write status when starting/stopping (in addition to writing on timer tick).</param>
        protected BaseStatusWriter(ILog logger, string progressFormatMessage, int pollIntervalSeconds, StatusWriterOptions options = StatusWriterOptions.WriteOnStop)
        {
            this.logger = logger;
            this.progressFormatMessage = progressFormatMessage;
            this.options = options;

            progressHeartbeatTimer           = new Timer(pollIntervalSeconds * 1000);
            progressHeartbeatTimer.Elapsed  += OnHeartbeat;
            progressHeartbeatTimer.AutoReset = true;
        }
Example #2
0
        /// <summary>
        /// Creates a new persister status heartbeat timer with the given parameters.
        /// </summary>
        /// <param name="persister">The persister to monitor the status of.</param>
        /// <param name="logger">The logger to append messages to.</param>
        /// <param name="progressFormatMessage">The progress message. Can contain tokens (see class summary).</param>
        /// <param name="pollIntervalSeconds">The number of seconds to wait between heartbeats.</param>
        /// <param name="expectedTotalPersistedItems">The number of iitems expected to be persisted.  Optional.</param>
        /// <param name="options">Options about when to write status.</param>
        public PersisterStatusWriter(IPersister <T> persister, ILog logger,
                                     string progressFormatMessage     = PluginLibConstants.DEFAULT_PERSISTER_STATUS_WRITER_PROGRESS_MESSAGE,
                                     int pollIntervalSeconds          = PluginLibConstants.DEFAULT_PROGRESS_MONITOR_POLLING_INTERVAL_SECONDS,
                                     long?expectedTotalPersistedItems = 0,
                                     StatusWriterOptions options      = StatusWriterOptions.WriteOnStop)
            : base(logger, progressFormatMessage, pollIntervalSeconds, options)
        {
            this.persister = persister;
            if (expectedTotalPersistedItems.HasValue)
            {
                this.expectedTotalPersistedItems = expectedTotalPersistedItems.Value;
            }

            Start();
        }
 /// <summary>
 /// Creates a new persister status heartbeat timer with the given parameters.
 /// </summary>
 /// <param name="persister">The persister to monitor the status of.</param>
 /// <param name="logger">The logger to append messages to.</param>
 /// <param name="progressFormatMessage">The progress message. Can contain tokens (see class summary).</param>
 /// <param name="pollIntervalSeconds">The number of seconds to wait between heartbeats.</param>
 /// <param name="expectedTotalPersistedItems">The number of iitems expected to be persisted.  Optional.</param>
 /// <param name="options">Options about when to write status.</param>
 public PersisterStatusWriter(IPersister <T> persister, ILog logger, string progressFormatMessage, int pollIntervalSeconds, long?expectedTotalPersistedItems = 0, StatusWriterOptions options = StatusWriterOptions.WriteOnStop)
     : base(logger, progressFormatMessage, pollIntervalSeconds, options)
 {
     this.persister = persister;
     if (expectedTotalPersistedItems.HasValue)
     {
         this.expectedTotalPersistedItems = expectedTotalPersistedItems.Value;
     }
     Start();
 }
Example #4
0
 /// <summary>
 /// Creates a new task progress heartbeat timer with the given parameters.
 /// </summary>
 /// <param name="tasks">The task list to monitor.</param>
 /// <param name="logger">The logger to append messages to.</param>
 /// <param name="progressFormatMessage">The progress message. Can contain tokens (see class summary).</param>
 /// <param name="pollIntervalSeconds">The number of seconds to wait between heartbeats.</param>
 /// <param name="expectedTotalTasks">The number of tasks expected to be executed.  Optional.</param>
 /// <param name="options">Options about when to write status.</param>
 public TaskStatusWriter(ICollection <Task> tasks, ILog logger, string progressFormatMessage, int pollIntervalSeconds, long?expectedTotalTasks = null, StatusWriterOptions options = StatusWriterOptions.WriteOnStop)
     : base(logger, progressFormatMessage, pollIntervalSeconds, options)
 {
     this.tasks = tasks;
     totalTasks = tasks.Count;
     if (expectedTotalTasks != null)
     {
         totalTasks = expectedTotalTasks.Value;
     }
 }