public SchedulerClient()
 {
     SchedulerEventGUID = Null.NullString;
     aProcessMethod = Null.NullString;
     Status = Null.NullString;
     ScheduleHistoryItem = new ScheduleHistoryItem();
 }
 public SchedulerClient()
 {
     //Assign the event a unique ID for tracking purposes.
     this._SchedulerEventGUID = Null.NullString;
     this._ProcessMethod = Null.NullString;
     this._Status = Null.NullString;
     this._ScheduleHistoryItem = new DotNetNuke.Services.Scheduling.ScheduleHistoryItem();
 }
Exemple #3
0
        // Add a queue request to Threadpool with a
        // callback to RunPooledThread which calls Run()
        public void AddQueueUserWorkItem(ScheduleItem s)
        {
            numberOfProcessesInQueue += 1;
            numberOfProcesses        += 1;
            var obj = new ScheduleHistoryItem(s);

            try
            {
                // Create a callback to subroutine RunPooledThread
                WaitCallback callback = this.RunPooledThread;

                // And put in a request to ThreadPool to run the process.
                ThreadPool.QueueUserWorkItem(callback, obj);
            }
            catch (Exception exc)
            {
                Exceptions.Exceptions.ProcessSchedulerException(exc);
            }
        }
Exemple #4
0
        private SchedulerClient GetSchedulerClient(string strProcess, ScheduleHistoryItem objScheduleHistoryItem)
        {
            //This is a method to encapsulate returning
            //an object whose class inherits SchedulerClient.
            Type t     = BuildManager.GetType(strProcess, true, true);
            var  param = new ScheduleHistoryItem[1];

            param[0] = objScheduleHistoryItem;
            var types = new Type[1];

            //Get the constructor for the Class
            types[0] = typeof(ScheduleHistoryItem);
            ConstructorInfo objConstructor;

            objConstructor = t.GetConstructor(types);

            //Return an instance of the class as an object
            return((SchedulerClient)objConstructor.Invoke(param));
        }
Exemple #5
0
        public override void RunScheduleItemNow(ScheduleItem scheduleItem, bool runNow)
        {
            //Remove item from queue
            Scheduler.CoreScheduler.RemoveFromScheduleQueue(scheduleItem);
            var scheduleHistoryItem = new ScheduleHistoryItem(scheduleItem)
            {
                NextStart = runNow ? DateTime.Now : (scheduleItem.ScheduleStartDate != Null.NullDate ? scheduleItem.ScheduleStartDate : DateTime.Now)
            };

            if (scheduleHistoryItem.TimeLapse != Null.NullInteger &&
                scheduleHistoryItem.TimeLapseMeasurement != Null.NullString &&
                scheduleHistoryItem.Enabled &&
                SchedulingController.CanRunOnThisServer(scheduleItem.Servers))
            {
                scheduleHistoryItem.ScheduleSource = ScheduleSource.STARTED_FROM_SCHEDULE_CHANGE;
                Scheduler.CoreScheduler.AddToScheduleQueue(scheduleHistoryItem);
            }

            DataCache.RemoveCache("ScheduleLastPolled");
        }
Exemple #6
0
 public static int AddScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     return(DataProvider.Instance().AddScheduleHistory(objScheduleHistoryItem.ScheduleID, objScheduleHistoryItem.StartDate, ServerController.GetExecutingServerName()));
 }
 public PurgeModuleCache(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem; //REQUIRED
 }
Exemple #8
0
        private SchedulerClient GetSchedulerClient(IServiceProvider services, string strProcess, ScheduleHistoryItem objScheduleHistoryItem)
        {
            // This is a method to encapsulate returning
            // an object whose class inherits SchedulerClient.
            Type t = BuildManager.GetType(strProcess, true, true);

            return((SchedulerClient)ActivatorUtilities.CreateInstance(services, t, objScheduleHistoryItem));
        }
 public DNNSnapshotScheduledTask(DotNetNuke.Services.Scheduling.ScheduleHistoryItem objScheduleHistoryItem)
     : base()
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public SynchronizeFileSystem(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public BattleFramework_SkirmishManagement(ScheduleHistoryItem oItem)
     : base()
 {
     this.ScheduleHistoryItem = oItem;
 }
            public static void LoadQueueFromEvent(EventName eventName)
            {
                var executingServer = ServerController.GetExecutingServerName();
                List<ScheduleItem> schedule = SchedulingController.GetScheduleByEvent(eventName.ToString(), executingServer);

                var thisServer = GetServer(executingServer);
                bool runningInAGroup = !String.IsNullOrEmpty(thisServer.ServerGroup);

                var serverGroupServers = ServerGroupServers(thisServer);

                foreach (ScheduleItem scheduleItem in schedule)
                {
                    if (runningInAGroup && String.IsNullOrEmpty(scheduleItem.Servers))
                    {
                        scheduleItem.Servers = serverGroupServers;
                    }
                    var historyItem = new ScheduleHistoryItem(scheduleItem);

                    if (!IsInQueue(historyItem) &&
                        !IsInProgress(historyItem) &&
                        !HasDependenciesConflict(historyItem) &&
                        historyItem.Enabled)
                    {
                        historyItem.ScheduleSource = ScheduleSource.STARTED_FROM_EVENT;
                        AddToScheduleQueue(historyItem);
                    }
                }
            }
            public static void WorkErrored(ScheduleHistoryItem scheduleHistoryItem, Exception exception)
            {
                try
                {
                    //Remove the object in the ScheduleInProgress collection
                    RemoveFromScheduleInProgress(scheduleHistoryItem);

                    //A SchedulerClient is notifying us that their
                    //process has errored.  Decrease our ActiveThreadCount
                    Interlocked.Decrement(ref _activeThreadCount);


                    Exceptions.Exceptions.ProcessSchedulerException(exception);

                    //Update the schedule item object property
                    //to note the end time and next start
                    scheduleHistoryItem.EndDate = DateTime.Now;
                    if (scheduleHistoryItem.ScheduleSource == ScheduleSource.STARTED_FROM_EVENT)
                    {
                        scheduleHistoryItem.NextStart = Null.NullDate;
                    }
                    else if (scheduleHistoryItem.RetryTimeLapse != Null.NullInteger)
                    {
                        switch (scheduleHistoryItem.RetryTimeLapseMeasurement)
                        {
                            case "s":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddSeconds(scheduleHistoryItem.RetryTimeLapse);
                                break;
                            case "m":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddMinutes(scheduleHistoryItem.RetryTimeLapse);
                                break;
                            case "h":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddHours(scheduleHistoryItem.RetryTimeLapse);
                                break;
                            case "d":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddDays(scheduleHistoryItem.RetryTimeLapse);
                                break;
                            case "w":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddDays(scheduleHistoryItem.RetryTimeLapse * 7);
                                break;
                            case "mo":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddMonths(scheduleHistoryItem.RetryTimeLapse);
                                break;
                            case "y":
                                scheduleHistoryItem.NextStart = scheduleHistoryItem.StartDate.AddYears(scheduleHistoryItem.RetryTimeLapse);
                                break;
                        }
                    }
                    //Update the ScheduleHistory in the database
                    UpdateScheduleHistory(scheduleHistoryItem);

                    if (scheduleHistoryItem.NextStart != Null.NullDate && scheduleHistoryItem.RetryTimeLapse != Null.NullInteger)
                    {
                        //Put the object back into the ScheduleQueue
                        //collection with the new NextStart date.
                        scheduleHistoryItem.StartDate = Null.NullDate;
                        scheduleHistoryItem.EndDate = Null.NullDate;
                        scheduleHistoryItem.LogNotes = "";
                        scheduleHistoryItem.ProcessGroup = -1;
                        AddToScheduleQueue(scheduleHistoryItem);
                    }

                    if (scheduleHistoryItem.RetainHistoryNum > 0)
                    {
                        //Write out the log entry for this event
                        var log = new LogInfo {LogTypeKey = "SCHEDULER_EVENT_FAILURE"};
                        log.AddProperty("THREAD ID", Thread.CurrentThread.GetHashCode().ToString());
                        log.AddProperty("TYPE", scheduleHistoryItem.TypeFullName);
                        if (exception != null)
                        {
                            log.AddProperty("EXCEPTION", exception.Message);
                        }
                        log.AddProperty("RESCHEDULED FOR", Convert.ToString(scheduleHistoryItem.NextStart));
                        log.AddProperty("SOURCE", scheduleHistoryItem.ScheduleSource.ToString());
                        log.AddProperty("ACTIVE THREADS", _activeThreadCount.ToString());
                        log.AddProperty("FREE THREADS", FreeThreads.ToString());
                        log.AddProperty("READER TIMEOUTS", _readerTimeouts.ToString());
                        log.AddProperty("WRITER TIMEOUTS", _writerTimeouts.ToString());
                        log.AddProperty("IN PROGRESS", GetScheduleInProgressCount().ToString());
                        log.AddProperty("IN QUEUE", GetScheduleQueueCount().ToString());
                        LogController.Instance.AddLog(log);
                    }
                }
                catch (Exception exc)
                {
                    Exceptions.Exceptions.ProcessSchedulerException(exc);
                }
            }
            public static ScheduleHistoryItem AddScheduleHistory(ScheduleHistoryItem scheduleHistoryItem)
            {
                try
                {
                    int scheduleHistoryID = SchedulingController.AddScheduleHistory(scheduleHistoryItem);
                    scheduleHistoryItem.ScheduleHistoryID = scheduleHistoryID;
                }
                catch (Exception exc)
                {
                    Exceptions.Exceptions.ProcessSchedulerException(exc);
                }

                return scheduleHistoryItem;
            }
 /// <summary>
 /// Adds an item to the collection of schedule items in queue.
 /// </summary>
 /// <param name="scheduleHistoryItem"></param>
 /// <remarks>Thread Safe</remarks>
 public static void AddToScheduleQueue(ScheduleHistoryItem scheduleHistoryItem)
 {
     if (!ScheduleQueueContains(scheduleHistoryItem))
     {
         try
         {
             //objQueueReadWriteLock.AcquireWriterLock(WriteTimeout)
             using (ScheduleQueue.GetWriteLock(LockTimeout))
             {
                 //Do a second check just in case
                 if (!ScheduleQueueContains(scheduleHistoryItem) &&
                     !IsInProgress(scheduleHistoryItem))
                 {
                     // It is safe for this thread to read or write
                     // from the shared resource.
                     ScheduleQueue.Add(scheduleHistoryItem);
                 }
             }
         }
         catch (ApplicationException ex)
         {
             // The writer lock request timed out.
             Interlocked.Increment(ref _writerTimeouts);
             Exceptions.Exceptions.LogException(ex);
         }
     }
 }
 private static bool ScheduleInProgressContains(ScheduleHistoryItem scheduleHistoryItem)
 {
     try
     {
         using (ScheduleInProgress.GetReadLock(LockTimeout))
         {
             return ScheduleInProgress.Any(si => si.ScheduleID == scheduleHistoryItem.ScheduleID);
         }
     }
     catch (ApplicationException ex)
     {
         Interlocked.Increment(ref _readerTimeouts);
         Exceptions.Exceptions.LogException(ex);
         return false;
     }
 }
            //DNN-5001
            public static void StopScheduleInProgress(ScheduleItem scheduleItem, ScheduleHistoryItem runningscheduleHistoryItem)
            {
                try
                {
                    //attempt to stop task only if it is still in progress
                    if (GetScheduleItemFromScheduleInProgress(scheduleItem) != null)
                    {
                        var scheduleHistoryItem = GetScheduleItemFromScheduleInProgress(scheduleItem);
                        scheduleHistoryItem.ScheduleHistoryID = runningscheduleHistoryItem.ScheduleHistoryID;
                        scheduleHistoryItem.StartDate = runningscheduleHistoryItem.StartDate;
                        //Remove the object in the ScheduleInProgress collection
                        RemoveFromScheduleInProgress(scheduleHistoryItem);

                        //A SchedulerClient is notifying us that their
                        //process has completed.  Decrease our ActiveThreadCount
                        Interlocked.Decrement(ref _activeThreadCount);

                        //Update the schedule item object property
                        //to note the end time and next start
                        scheduleHistoryItem.EndDate = DateTime.Now;

                        if (scheduleHistoryItem.ScheduleSource == ScheduleSource.STARTED_FROM_EVENT)
                        {
                            scheduleHistoryItem.NextStart = Null.NullDate;
                        }
                        else
                        {
                            if (scheduleHistoryItem.CatchUpEnabled)
                            {
                                switch (scheduleHistoryItem.TimeLapseMeasurement)
                                {
                                    case "s":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.NextStart.AddSeconds(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "m":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.NextStart.AddMinutes(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "h":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.NextStart.AddHours(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "d":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.NextStart.AddDays(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "w":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddDays(scheduleHistoryItem.TimeLapse*7);
                                        break;
                                    case "mo":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddMonths(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "y":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddYears(scheduleHistoryItem.TimeLapse);
                                        break;
                                }
                            }
                            else
                            {
                                switch (scheduleHistoryItem.TimeLapseMeasurement)
                                {
                                    case "s":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddSeconds(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "m":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddMinutes(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "h":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddHours(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "d":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddDays(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "w":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddDays(scheduleHistoryItem.TimeLapse*7);
                                        break;
                                    case "mo":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddMonths(scheduleHistoryItem.TimeLapse);
                                        break;
                                    case "y":
                                        scheduleHistoryItem.NextStart =
                                            scheduleHistoryItem.StartDate.AddYears(scheduleHistoryItem.TimeLapse);
                                        break;
                                }
                            }
                        }
                        //Update the ScheduleHistory in the database
                        UpdateScheduleHistory(scheduleHistoryItem);


                        if (scheduleHistoryItem.NextStart != Null.NullDate)
                        {
                            //Put the object back into the ScheduleQueue
                            //collection with the new NextStart date.
                            scheduleHistoryItem.StartDate = Null.NullDate;
                            scheduleHistoryItem.EndDate = Null.NullDate;
                            scheduleHistoryItem.LogNotes = "";
                            scheduleHistoryItem.ProcessGroup = -1;
                            AddToScheduleQueue(scheduleHistoryItem);
                        }

                        //Write out the log entry for this event
                        var log = new LogInfo {LogTypeKey = "SCHEDULER_EVENT_COMPLETED"};
                        log.AddProperty("REASON", "Scheduler task has been stopped manually");
                        log.AddProperty("TYPE", scheduleHistoryItem.TypeFullName);
                        log.AddProperty("THREAD ID", Thread.CurrentThread.GetHashCode().ToString());
                        log.AddProperty("NEXT START", Convert.ToString(scheduleHistoryItem.NextStart));
                        LogController.Instance.AddLog(log);
                    }

                }
                catch (Exception exc)
                {
                    Exceptions.Exceptions.ProcessSchedulerException(exc);
                }
            }
            public static void WorkStarted(ScheduleHistoryItem scheduleHistoryItem)
            {
                bool activeThreadCountIncremented = false;
                try
                {
                    scheduleHistoryItem.ThreadID = Thread.CurrentThread.GetHashCode();

                    //Put the object in the ScheduleInProgress collection
                    //and remove it from the ScheduleQueue
                    RemoveFromScheduleQueue(scheduleHistoryItem);
                    AddToScheduleInProgress(scheduleHistoryItem);

                    //A SchedulerClient is notifying us that their
                    //process has started.  Increase our ActiveThreadCount
                    Interlocked.Increment(ref _activeThreadCount);
                    activeThreadCountIncremented = true;

                    //Update the schedule item
                    //object property to note the start time.
                    scheduleHistoryItem.StartDate = DateTime.Now;
                    AddScheduleHistory(scheduleHistoryItem);
                    
                    if (scheduleHistoryItem.RetainHistoryNum > 0)
                    {
                        //Write out the log entry for this event
                        var log = new LogInfo {LogTypeKey = "SCHEDULER_EVENT_STARTED"};
                        log.AddProperty("THREAD ID", Thread.CurrentThread.GetHashCode().ToString());
                        log.AddProperty("TYPE", scheduleHistoryItem.TypeFullName);
                        log.AddProperty("SOURCE", scheduleHistoryItem.ScheduleSource.ToString());
                        log.AddProperty("ACTIVE THREADS", _activeThreadCount.ToString());
                        log.AddProperty("FREE THREADS", FreeThreads.ToString());
                        log.AddProperty("READER TIMEOUTS", _readerTimeouts.ToString());
                        log.AddProperty("WRITER TIMEOUTS", _writerTimeouts.ToString());
                        log.AddProperty("IN PROGRESS", GetScheduleInProgressCount().ToString());
                        log.AddProperty("IN QUEUE", GetScheduleQueueCount().ToString());
                        LogController.Instance.AddLog(log);
                    }
                }
                catch (Exception exc)
                {
                    //Decrement the ActiveThreadCount because
                    //otherwise the number of active threads
                    //will appear to be climbing when in fact
                    //no tasks are being executed.
                    if (activeThreadCountIncremented)
                    {
                        Interlocked.Decrement(ref _activeThreadCount);
                    }
                    Exceptions.Exceptions.ProcessSchedulerException(exc);
                }
            }
 public MessagingScheduler(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
            public static void LoadQueueFromTimer()
            {
                _forceReloadSchedule = false;
                var executingServer = ServerController.GetExecutingServerName();
                List<ScheduleItem> schedule = SchedulingController.GetSchedule(executingServer);

                var thisServer = GetServer(executingServer);
                bool runningInAGroup = !String.IsNullOrEmpty(thisServer.ServerGroup);
                
                var serverGroupServers = ServerGroupServers(thisServer);


                foreach (ScheduleItem scheduleItem in schedule)
                {
                    if (runningInAGroup && String.IsNullOrEmpty(scheduleItem.Servers))
                    {
                        scheduleItem.Servers = serverGroupServers;
                    }

                    var historyItem = new ScheduleHistoryItem(scheduleItem);

                    if (!IsInQueue(historyItem) &&
                        historyItem.TimeLapse != Null.NullInteger &&
                        historyItem.TimeLapseMeasurement != Null.NullString &&
                        historyItem.Enabled)
                    {
                        if (SchedulingProvider.SchedulerMode == SchedulerMode.TIMER_METHOD)
                        {
                            historyItem.ScheduleSource = ScheduleSource.STARTED_FROM_TIMER;
                        }
                        else if (SchedulingProvider.SchedulerMode == SchedulerMode.REQUEST_METHOD)
                        {
                            historyItem.ScheduleSource = ScheduleSource.STARTED_FROM_BEGIN_REQUEST;
                        }
                        AddToScheduleQueue(historyItem);
                    }
                }
            }
 public static int AddScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     return DataProvider.Instance().AddScheduleHistory(objScheduleHistoryItem.ScheduleID, objScheduleHistoryItem.StartDate, ServerController.GetExecutingServerName());
 }
 public static void UpdateScheduleHistory(ScheduleHistoryItem scheduleHistoryItem)
 {
     try
     {
         SchedulingController.UpdateScheduleHistory(scheduleHistoryItem);
     }
     catch (Exception exc)
     {
         Exceptions.Exceptions.ProcessSchedulerException(exc);
     }
 }
 public PurgeLogBuffer(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
        public override void RunScheduleItemNow(ScheduleItem scheduleItem, bool runNow)
        {
            //Remove item from queue
            Scheduler.CoreScheduler.RemoveFromScheduleQueue(scheduleItem);
            var scheduleHistoryItem = new ScheduleHistoryItem(scheduleItem) { NextStart = runNow ? DateTime.Now : (scheduleItem.ScheduleStartDate != Null.NullDate ? scheduleItem.ScheduleStartDate : DateTime.Now) };

            if (scheduleHistoryItem.TimeLapse != Null.NullInteger
                && scheduleHistoryItem.TimeLapseMeasurement != Null.NullString
                && scheduleHistoryItem.Enabled
                && CanRunOnThisServer(scheduleItem.Servers))
            {
                scheduleHistoryItem.ScheduleSource = ScheduleSource.STARTED_FROM_SCHEDULE_CHANGE;
                Scheduler.CoreScheduler.AddToScheduleQueue(scheduleHistoryItem);
            }

            DataCache.RemoveCache("ScheduleLastPolled");
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Constructs a PurgeUsesOnline SchedulerClient
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="objScheduleHistoryItem">A SchedulerHistiryItem</param>
 /// <history>
 ///     [cnurse]	03/14/2006	documented
 /// </history>
 /// -----------------------------------------------------------------------------
 public PurgeUsersOnline(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public PublishScheduledTasks(ScheduleHistoryItem shi)
 {
     this.ScheduleHistoryItem = shi;
 }
 public PurgeScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public NotificationSchedule(DotNetNuke.Services.Scheduling.ScheduleHistoryItem objScheduleHistoryItem)
     : base()
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public DeleteMessages(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
Exemple #30
0
 internal bool CompactSearchIndexIfNeeded(ScheduleHistoryItem scheduleItem)
 {
     var shelper = SearchHelper.Instance;
     if (shelper.GetSearchCompactFlag())
     {
         shelper.SetSearchReindexRequestTime(false);
         var stopWatch = System.Diagnostics.Stopwatch.StartNew();
         if (InternalSearchController.Instance.OptimizeSearchIndex())
         {
             stopWatch.Stop();
             scheduleItem.AddLogNote(string.Format("<br/><b>Compacted Index, total time {0}</b>", stopWatch.Elapsed));
         }
     }
     return false;
 }
Exemple #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PurgeScheduleHistory"/> class.
 /// </summary>
 /// <param name="objScheduleHistoryItem"></param>
 public PurgeScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
Exemple #32
0
 public EmailInviteManagement(ScheduleHistoryItem oItem)
     : base()
 {
     this.ScheduleHistoryItem = oItem;
 }
Exemple #33
0
        public void Run(ScheduleHistoryItem objScheduleHistoryItem)
        {
            SchedulerClient Process = null;

            try
            {
                //This is called from RunPooledThread()
                ticksElapsed = Environment.TickCount - ticksElapsed;
                Process      = GetSchedulerClient(objScheduleHistoryItem.TypeFullName, objScheduleHistoryItem);
                Process.ScheduleHistoryItem = objScheduleHistoryItem;

                //Set up the handlers for the CoreScheduler
                Process.ProcessStarted     += Scheduler.CoreScheduler.WorkStarted;
                Process.ProcessProgressing += Scheduler.CoreScheduler.WorkProgressing;
                Process.ProcessCompleted   += Scheduler.CoreScheduler.WorkCompleted;
                Process.ProcessErrored     += Scheduler.CoreScheduler.WorkErrored;
                //This kicks off the DoWork method of the class
                //type specified in the configuration.

                Process.Started();
                try
                {
                    Process.ScheduleHistoryItem.Succeeded = false;
                    Process.DoWork();
                }
                catch (Exception exc)
                {
                    //in case the scheduler client
                    //didn't have proper exception handling
                    //make sure we fire the Errored event
                    Logger.Error(exc);

                    if (Process != null)
                    {
                        if (Process.ScheduleHistoryItem != null)
                        {
                            Process.ScheduleHistoryItem.Succeeded = false;
                        }
                        Process.Errored(ref exc);
                    }
                }
                if (Process.ScheduleHistoryItem.Succeeded)
                {
                    Process.Completed();
                }

                //If all processes in this ProcessGroup have
                //completed, set the ticksElapsed and raise
                //the Completed event.
                //I don't think this is necessary with the
                //other events.  I'll leave it for now and
                //will probably take it out later.

                if (processesCompleted == numberOfProcesses)
                {
                    if (processesCompleted == numberOfProcesses)
                    {
                        ticksElapsed = Environment.TickCount - ticksElapsed;
                        if (Completed != null)
                        {
                            Completed();
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                //in case the scheduler client
                //didn't have proper exception handling
                //make sure we fire the Errored event
                if (Process != null)
                {
                    if (Process.ScheduleHistoryItem != null)
                    {
                        Process.ScheduleHistoryItem.Succeeded = false;
                    }
                    Process.Errored(ref exc);
                }
                else
                {
                    //when the schedule has invalid config and can't initialize the Process,
                    //we need also trigger work errored event so that the schedule can remove from inprogress and inqueue list to prevent endless loop.
                    Scheduler.CoreScheduler.WorkStarted(objScheduleHistoryItem);
                    objScheduleHistoryItem.Succeeded = false;
                    Scheduler.CoreScheduler.WorkErrored(objScheduleHistoryItem, exc);
                }
            }
            finally
            {
                //Track how many processes have completed for
                //this instanciation of the ProcessGroup
                numberOfProcessesInQueue -= 1;
                processesCompleted       += 1;
            }
        }
Exemple #34
0
 public SchedulerHelper(DotNetNuke.Services.Scheduling.ScheduleHistoryItem objScheduleHistoryItem)
     : base()
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public PurgeSiteLog(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
Exemple #36
0
 public SearchEngineScheduler(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
 public static void UpdateScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     DataProvider.Instance().UpdateScheduleHistory(objScheduleHistoryItem.ScheduleHistoryID,
                                                   objScheduleHistoryItem.EndDate,
                                                   objScheduleHistoryItem.Succeeded,
                                                   objScheduleHistoryItem.LogNotes,
                                                   objScheduleHistoryItem.NextStart);
 }
 public SendLogNotifications(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
Exemple #39
0
 public SkirmishManagement(ScheduleHistoryItem oItem)
     : base()
 {
     this.ScheduleHistoryItem = oItem;
 }
 /// <summary>
 /// adds an item to the collection of schedule items in progress.
 /// </summary>
 /// <param name="scheduleHistoryItem">Item to add</param>
 /// <remarks>Thread Safe</remarks>
 private static void AddToScheduleInProgress(ScheduleHistoryItem scheduleHistoryItem)
 {
     if (!(ScheduleInProgressContains(scheduleHistoryItem)))
     {
         try
         {
             using (ScheduleInProgress.GetWriteLock(LockTimeout))
             {
                 if (!(ScheduleInProgressContains(scheduleHistoryItem)))
                 {
                     ScheduleInProgress.Add(scheduleHistoryItem);
                 }
             }
         }
         catch (ApplicationException ex)
         {
             // The writer lock request timed out.
             Interlocked.Increment(ref _writerTimeouts);
             Exceptions.Exceptions.LogException(ex);
         }
     }
 }