コード例 #1
0
ファイル: ProcessGroup.cs プロジェクト: misterPaul0/Curt
        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));
        }
コード例 #2
0
ファイル: ProcessGroup.cs プロジェクト: misterPaul0/Curt
        //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 = RunPooledThread;
                //And put in a request to ThreadPool to run the process.
                ThreadPool.QueueUserWorkItem(callback, obj);
                Thread.Sleep(1000);
            }
            catch (Exception exc)
            {
                Exceptions.Exceptions.ProcessSchedulerException(exc);
            }
        }
コード例 #3
0
 public override void DoWork()
 {
     try
     {
         Progressing();
         //DO THE WORK
         DataProvider.Instance().RunPublishStats();
         string returnMessage = "";
         returnMessage += " <br /> Stats Parsed Successfully";
         ScheduleHistoryItem.Succeeded = true;
         ScheduleHistoryItem.AddLogNote(returnMessage);
     }
     catch (Exception exc)
     {
         ScheduleHistoryItem.Succeeded = false;
         ScheduleHistoryItem.AddLogNote("Stats Failed, did you configure the settings?");
         Errored(ref exc);
     }
 }
コード例 #4
0
        public override void DoWork()
        {
            try
            {
                Progressing();



                ScheduleHistoryItem.Succeeded = true;
                ScheduleHistoryItem.AddLogNote("Sent warrant expiration notifications successfully");
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("EXCEPTION: " + ex);
                Errored(ref ex);
                Exceptions.LogException(ex);
            }
        }
コード例 #5
0
 public override void DoWork()
 {
     try
     {
         //notification that the event is progressing
         Progressing();                                                         //OPTIONAL
         LoggingProvider.Instance().SendLogNotifications();
         ScheduleHistoryItem.Succeeded = true;                                  //REQUIRED
         ScheduleHistoryItem.AddLogNote("Sent log notifications successfully"); //OPTIONAL
     }
     catch (Exception exc)                                                      //REQUIRED
     {
         ScheduleHistoryItem.Succeeded = false;                                 //REQUIRED
         ScheduleHistoryItem.AddLogNote("EXCEPTION: " + exc);                   //OPTIONAL
         Errored(ref exc);                                                      //REQUIRED
         //log the exception
         Exceptions.Exceptions.LogException(exc);                               //OPTIONAL
     }
 }
コード例 #6
0
        public override int AddSchedule(ScheduleItem objScheduleItem)
        {
            Scheduler.CoreScheduler.RemoveFromScheduleQueue(objScheduleItem);

            SchedulingController s = new SchedulingController();
            int i = s.AddSchedule(objScheduleItem.TypeFullName, objScheduleItem.TimeLapse, objScheduleItem.TimeLapseMeasurement, objScheduleItem.RetryTimeLapse, objScheduleItem.RetryTimeLapseMeasurement, objScheduleItem.RetainHistoryNum, objScheduleItem.AttachToEvent, objScheduleItem.CatchUpEnabled, objScheduleItem.Enabled, objScheduleItem.ObjectDependencies, objScheduleItem.Servers);

            ScheduleHistoryItem objScheduleHistoryItem = new ScheduleHistoryItem(objScheduleItem);

            objScheduleHistoryItem.NextStart  = DateTime.Now;
            objScheduleHistoryItem.ScheduleID = i;

            if (objScheduleHistoryItem.TimeLapse != Null.NullInteger && objScheduleHistoryItem.TimeLapseMeasurement != Null.NullString && objScheduleHistoryItem.Enabled)
            {
                objScheduleHistoryItem.ScheduleSource = ScheduleSource.STARTED_FROM_SCHEDULE_CHANGE;
                Scheduler.CoreScheduler.AddToScheduleQueue(objScheduleHistoryItem);
            }
            DataCache.RemoveCache("ScheduleLastPolled");
            return(i);
        }
コード例 #7
0
ファイル: TabIndexer.cs プロジェクト: Mariusz11711/DNN
        /// <summary>Converts applicable pages into <see cref="SearchDocument"/> instances before passing them to the <paramref name="indexer"/>.</summary>
        /// <inheritdoc />
        public override int IndexSearchDocuments(int portalId, ScheduleHistoryItem schedule, DateTime startDateLocal, Action <IEnumerable <SearchDocument> > indexer)
        {
            Requires.NotNull("indexer", indexer);
            const int saveThreshold = 1024;
            var       totalIndexed  = 0;

            startDateLocal = this.GetLocalTimeOfLastIndexedItem(portalId, schedule.ScheduleID, startDateLocal);
            var searchDocuments = new List <SearchDocument>();
            var tabs            = (
                from t in TabController.Instance.GetTabsByPortal(portalId).AsList()
                where t.LastModifiedOnDate > startDateLocal && t.AllowIndex
                select t).OrderBy(t => t.LastModifiedOnDate).ThenBy(t => t.TabID).ToArray();

            if (tabs.Any())
            {
                foreach (var tab in tabs)
                {
                    try
                    {
                        var searchDoc = GetTabSearchDocument(tab);
                        searchDocuments.Add(searchDoc);

                        if (searchDocuments.Count >= saveThreshold)
                        {
                            totalIndexed += this.IndexCollectedDocs(indexer, searchDocuments, portalId, schedule.ScheduleID);
                        }
                    }
                    catch (Exception ex)
                    {
                        Exceptions.Exceptions.LogException(ex);
                    }
                }

                if (searchDocuments.Count > 0)
                {
                    totalIndexed += this.IndexCollectedDocs(indexer, searchDocuments, portalId, schedule.ScheduleID);
                }
            }

            return(totalIndexed);
        }
コード例 #8
0
 public override void DoWork()
 {
     try
     {
         Logger.Trace("AppService server checker scheduled job starting");
         Progressing();
         PingServers();
         ChangeScheduledTasksServerAffinity();
         CleanupOldServers();
         ScheduleHistoryItem.Succeeded = true;
         Logger.Trace("AppService server checker scheduled job finished successfully");
     }
     catch (Exception ex)
     {
         ScheduleHistoryItem.Succeeded = false;
         ScheduleHistoryItem.AddLogNote($"Error: {ex}");
         Errored(ref ex);
         Exceptions.LogException(ex);
         Logger.Trace("AppService server checker scheduled job finished with errors");
     }
 }
コード例 #9
0
        public override void DoWork()
        {
            try
            {
                //Perform required items for logging
                Progressing();

                ScheduleHistoryItem.AddLogNote("Starting Azure AD B2C Synchronization\n");

                // Run optional pre-sync stored procedure
                RunStoredProcedureIfExists($"{AzureConfig.ServiceName}_BeforeScheduledSync");

                var portals = PortalController.Instance.GetPortalList(Null.NullString);
                foreach (var portal in portals)
                {
                    var settings = new AzureConfig(AzureConfig.ServiceName, portal.PortalID);
                    if (settings.Enabled && settings.RoleSyncEnabled)
                    {
                        var message = SyncRoles(portal.PortalID, settings);
                        ScheduleHistoryItem.AddLogNote(message);
                    }
                }

                // Run optional post-sync stored procedure
                RunStoredProcedureIfExists($"{AzureConfig.ServiceName}_AfterScheduledSync");

                ScheduleHistoryItem.AddLogNote(string.Format("Azure AD B2C Synchronization finished successfully\n"));

                //Show success
                ScheduleHistoryItem.Succeeded = true;
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote(string.Format("Error performing Azure AD B2C Synchronization: {0}\n", ex.Message));;

                Errored(ref ex);
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
            }
        }
コード例 #10
0
        public override void DoWork()
        {
            try {
                // perform required items for logging
                Progressing();

                var itemsImported = Import(1000);

                // log result
                ScheduleHistoryItem.AddLogNote("Items imported: " + itemsImported);

                // show success
                ScheduleHistoryItem.Succeeded = true;
                Completed();
            }
            catch (Exception ex) {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("Exception: " + ex);
                Errored(ref ex);
                Exceptions.LogException(ex);
            }
        }
コード例 #11
0
        public override void DoWork()
        {
            try
            {
                string str = CachingProvider.Instance().PurgeCache();

                ScheduleHistoryItem.Succeeded = true; //REQUIRED
                ScheduleHistoryItem.AddLogNote(str);
            }
            catch (Exception exc)                      //REQUIRED
            {
                ScheduleHistoryItem.Succeeded = false; //REQUIRED

                ScheduleHistoryItem.AddLogNote(string.Format("Purging cache task failed: {0}.", exc.ToString()));

                //notification that we have errored
                Errored(ref exc); //REQUIRED

                //log the exception
                Exceptions.Exceptions.LogException(exc); //OPTIONAL
            }
        }
コード例 #12
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DoWork runs the scheduled item
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        ///     [vqnguyen]  05/28/2013  updated
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DoWork()
        {
            try
            {
                var lastSuccessFulDateTime = SearchHelper.Instance.GetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID);
                Log.Logger.Trace("Search: File Crawler - Starting. Content change start time " + lastSuccessFulDateTime.ToString("g"));
                ScheduleHistoryItem.AddLogNote(string.Format("Starting. Content change start time <b>{0:g}</b>", lastSuccessFulDateTime));

                var searchEngine = LuceneController.Instance;
                try
                {
                    searchEngine.IndexContent(lastSuccessFulDateTime);
                }
                catch (Exception ex)
                {
                    Log.Logger.ErrorFormat("Failed executing Scheduled Reindexing. Error: {0}", ex.Message);
                }
                finally
                {
                    //searchEngine.Commit();
                }

                ScheduleHistoryItem.Succeeded = true;
                ScheduleHistoryItem.AddLogNote("<br/><b>Indexing Successful</b>");
                SearchHelper.Instance.SetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID, ScheduleHistoryItem.StartDate);

                Log.Logger.Trace("Search: File Crawler - Indexing Successful");
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("<br/>EXCEPTION: " + ex.Message);
                Errored(ref ex);
                if (ScheduleHistoryItem.ScheduleSource != ScheduleSource.STARTED_FROM_BEGIN_REQUEST)
                {
                    Exceptions.LogException(ex);
                }
            }
        }
コード例 #13
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DoWork does th4 Scheduler work
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void DoWork()
        {
            try
            {
                //notification that the event is progressing
                Progressing();                        //OPTIONAL
                UpdateUsersOnline();
                ScheduleHistoryItem.Succeeded = true; //REQUIRED
                ScheduleHistoryItem.AddLogNote("UsersOnline purge completed.");
            }
            catch (Exception exc)                      //REQUIRED
            {
                ScheduleHistoryItem.Succeeded = false; //REQUIRED
                ScheduleHistoryItem.AddLogNote("UsersOnline purge failed." + exc);

                //notification that we have errored
                Errored(ref exc);

                //log the exception
                Exceptions.LogException(exc);
            }
        }
コード例 #14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DoWork runs the scheduled item
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        public override void DoWork()
        {
            try
            {
                var lastSuccessFulDateTime = SearchHelper.Instance.GetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID);
                Logger.Trace("Search: Site Crawler - Starting. Content change start time " + lastSuccessFulDateTime.ToString("g"));
                ScheduleHistoryItem.AddLogNote(string.Format("Starting. Content change start time <b>{0:g}</b>", lastSuccessFulDateTime));

                var searchEngine = new SearchEngine(ScheduleHistoryItem, lastSuccessFulDateTime);
                try
                {
                    searchEngine.DeleteOldDocsBeforeReindex();
                    searchEngine.DeleteRemovedObjects();
                    searchEngine.IndexContent();
                    searchEngine.CompactSearchIndexIfNeeded(ScheduleHistoryItem);
                }
                finally
                {
                    searchEngine.Commit();
                }

                ScheduleHistoryItem.Succeeded = true;
                ScheduleHistoryItem.AddLogNote("<br/><b>Indexing Successful</b>");
                SearchHelper.Instance.SetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID, ScheduleHistoryItem.StartDate);

                Logger.Trace("Search: Site Crawler - Indexing Successful");
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("<br/>EXCEPTION: " + ex.Message);
                Errored(ref ex);
                if (ScheduleHistoryItem.ScheduleSource != ScheduleSource.STARTED_FROM_BEGIN_REQUEST)
                {
                    Exceptions.Exceptions.LogException(ex);
                }
            }
        }
コード例 #15
0
ファイル: PurgeOutputCache.cs プロジェクト: misterPaul0/Curt
        public override void DoWork()
        {
            try
            {
                ArrayList portals;
                var       portalController = new PortalController();
                portals = portalController.GetPortals();
                foreach (KeyValuePair <string, OutputCachingProvider> kvp in OutputCachingProvider.GetProviderList())
                {
                    try
                    {
                        foreach (PortalInfo portal in portals)
                        {
                            kvp.Value.PurgeExpiredItems(portal.PortalID);
                            ScheduleHistoryItem.AddLogNote(string.Format("Purged output cache for {0}.  ", kvp.Key));
                        }
                    }
                    catch (NotSupportedException exc)
                    {
                        //some output caching providers don't use this feature
                        Instrumentation.DnnLog.Debug(exc);
                    }
                }
                ScheduleHistoryItem.Succeeded = true;                                                                    //REQUIRED
            }
            catch (Exception exc)                                                                                        //REQUIRED
            {
                ScheduleHistoryItem.Succeeded = false;                                                                   //REQUIRED

                ScheduleHistoryItem.AddLogNote(string.Format("Purging output cache task failed: {0}.", exc.ToString())); //OPTIONAL

                //notification that we have errored
                Errored(ref exc);

                //log the exception
                Exceptions.Exceptions.LogException(exc); //OPTIONAL
            }
        }
コード例 #16
0
 private void CleanupOldServers()
 {
     try
     {
         var maxDisabledServersLifeInDays = HostController.Instance.GetInteger("WebServer_MaxDisabledServersLifeInDays", 30);
         var oldServers = ServerController.GetServers().Where(x => !x.Enabled &&
                                                              x.LastActivityDate < DateTime.Now.AddDays(-maxDisabledServersLifeInDays));
         foreach (var server in oldServers)
         {
             var serverName = ServerController.GetServerName(server);
             ServerController.DeleteServer(server.ServerID);
             var message = $"Server '{serverName}' was deleted because was disabled for more than {maxDisabledServersLifeInDays} days";
             Logger.Info(message);
             ScheduleHistoryItem.AddLogNote(message);
         }
     }
     catch (Exception ex)
     {
         var message = $"Error cleaning up old servers: {ex.Message}";
         ScheduleHistoryItem.AddLogNote(message);
         Exceptions.LogException(ex);
     }
 }
コード例 #17
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);
            ScheduleHistoryItem[] param = new ScheduleHistoryItem[1];
            param[0] = objScheduleHistoryItem;

            ///''''''''''''''''''''''''''''''''''''''''''''''''
            //Get the constructor for the Class
            ///''''''''''''''''''''''''''''''''''''''''''''''''
            Type[] types = new Type[1];
            types[0] = typeof( ScheduleHistoryItem );
            ConstructorInfo objConstructor;
            objConstructor = t.GetConstructor( types );

            ///''''''''''''''''''''''''''''''''''''''''''''''''
            //Return an instance of the class as an object
            ///''''''''''''''''''''''''''''''''''''''''''''''''
            return ( (SchedulerClient)objConstructor.Invoke( param ) );
        }
コード例 #18
0
        public override void DoWork()
        {
            try
            {
                //Perform required items for logging
                Progressing();

                ImportCommentsFromDisqus();

                //To log note
                //this.ScheduleHistoryItem.AddLogNote("note");

                //Show success
                ScheduleHistoryItem.Succeeded = true;
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("Exception= " + ex.ToString());
                Errored(ref ex);
                Exceptions.LogException(ex);
            }
        }
コード例 #19
0
        public override void DoWork()
        {
            try
            {
                lock (VanjaroCommonLock)
                {
                    ProcessMailQueue();//Run Every 2 Minute

                    if (SchedulerLog.Count > 0)
                    {
                        StringBuilder LogNote = new StringBuilder();
                        foreach (string str in SchedulerLog)
                        {
                            LogNote.Append(str + " | ");
                        }
                        ScheduleHistoryItem.AddLogNote("<br />&nbsp; - " + LogNote.ToString().TrimEnd(' ', '|'));
                    }
                    else
                    {
                        ScheduleHistoryItem.AddLogNote("<br />&nbsp; - " + "Idle - No Work Performed.");
                    }

                    ScheduleHistoryItem.Succeeded = true;
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                Errored(ref ex);
                ScheduleHistoryItem.AddLogNote("Not able to run successfully. Check your event log.");
                ScheduleHistoryItem.Succeeded = false;
            }
            finally
            {
                SchedulerLog = null;
            }
        }
コード例 #20
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 += new WorkStarted( Scheduler.CoreScheduler.WorkStarted );
                Process.ProcessProgressing += new WorkProgressing( Scheduler.CoreScheduler.WorkProgressing );
                Process.ProcessCompleted += new WorkCompleted( Scheduler.CoreScheduler.WorkCompleted );
                Process.ProcessErrored += new WorkErrored( 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
                    if(Process != null)
                    {
                        Process.ScheduleHistoryItem.Succeeded = false;
                        Process.Errored( ref exc );
                    }
                }
                if( Process.ScheduleHistoryItem.Succeeded == true )
                {
                    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( CompletedEvent != null )
                        {
                            CompletedEvent();
                        }
                    }
                }
            }
            catch( Exception exc )
            {
                //in case the scheduler client
                //didn't have proper exception handling
                //make sure we fire the Errored event
                if (Process != null)
                {
                    Process.ScheduleHistoryItem.Succeeded = false;
                    Process.Errored( ref exc );
                }
            }
            finally
            {
                ///''''''''''''''''''''''''''''''''''''''''''''''''
                //Track how many processes have completed for
                //this instanciation of the ProcessGroup
                ///''''''''''''''''''''''''''''''''''''''''''''''''
                numberOfProcessesInQueue--;
                processesCompleted++;
            }
        }
コード例 #21
0
        ///''''''''''''''''''''''''''''''''''''''''''''''''
        //Add a queue request to Threadpool with a
        //callback to RunPooledThread which calls Run()
        ///''''''''''''''''''''''''''''''''''''''''''''''''
        public void AddQueueUserWorkItem( ScheduleItem s )
        {
            numberOfProcessesInQueue++;
            numberOfProcesses++;
            ScheduleHistoryItem obj = new ScheduleHistoryItem();
            obj.TypeFullName = s.TypeFullName;
            obj.ScheduleID = s.ScheduleID;
            obj.TimeLapse = s.TimeLapse;
            obj.TimeLapseMeasurement = s.TimeLapseMeasurement;
            obj.RetryTimeLapse = s.RetryTimeLapse;
            obj.RetryTimeLapseMeasurement = s.RetryTimeLapseMeasurement;
            obj.ObjectDependencies = s.ObjectDependencies;
            obj.CatchUpEnabled = s.CatchUpEnabled;
            obj.Enabled = s.Enabled;
            obj.NextStart = s.NextStart;
            obj.ScheduleSource = s.ScheduleSource;
            obj.ThreadID = s.ThreadID;
            obj.ProcessGroup = s.ProcessGroup;
            obj.RetainHistoryNum = s.RetainHistoryNum;

            try
            {
                // Create a callback to subroutine RunPooledThread
                WaitCallback callback = new WaitCallback( RunPooledThread );
                // And put in a request to ThreadPool to run the process.
                ThreadPool.QueueUserWorkItem( callback, ( (object)obj ) );
                Thread.Sleep( 1000 );
            }
            catch( Exception exc )
            {
                Exceptions.Exceptions.ProcessSchedulerException( exc );
            }
        }
コード例 #22
0
ファイル: SchedulingController.cs プロジェクト: biganth/Curt
 public static void UpdateScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     DataProvider.Instance().UpdateScheduleHistory(objScheduleHistoryItem.ScheduleHistoryID,
                                                   objScheduleHistoryItem.EndDate,
                                                   objScheduleHistoryItem.Succeeded,
                                                   objScheduleHistoryItem.LogNotes,
                                                   objScheduleHistoryItem.NextStart);
 }
コード例 #23
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
 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;
     }
 }
コード例 #24
0
ファイル: SchedulingController.cs プロジェクト: biganth/Curt
 public static int AddScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
 {
     return DataProvider.Instance().AddScheduleHistory(objScheduleHistoryItem.ScheduleID, objScheduleHistoryItem.StartDate, ServerController.GetExecutingServerName());
 }
コード例 #25
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
 /// <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);
         }
     }
 }
コード例 #26
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
            public static void LoadQueueFromEvent(EventName eventName)
            {
                List<ScheduleItem> schedule = SchedulingController.GetScheduleByEvent(eventName.ToString(), ServerController.GetExecutingServerName());

                foreach (ScheduleItem scheduleItem in schedule)
                {
                    var historyItem = new ScheduleHistoryItem(scheduleItem);

                    if (!IsInQueue(historyItem) &&
                        !IsInProgress(historyItem) &&
                        !HasDependenciesConflict(historyItem) &&
                        historyItem.Enabled)
                    {
                        historyItem.ScheduleSource = ScheduleSource.STARTED_FROM_EVENT;
                        AddToScheduleQueue(historyItem);
                    }
                }
            }
コード例 #27
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
 /// <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);
         }
     }
 }
コード例 #28
0
ファイル: SchedulingProvider.cs プロジェクト: biganth/Curt
 public override void RunScheduleItemNow(ScheduleItem scheduleItem)
 {
     //Remove item from queue
     Scheduler.CoreScheduler.RemoveFromScheduleQueue(scheduleItem);
     var scheduleHistoryItem = new ScheduleHistoryItem(scheduleItem);
     scheduleHistoryItem.NextStart = 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");
 }
コード例 #29
0
 public SearchEngineScheduler(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #30
0
 /// <summary>Initializes a new instance of the <see cref="CoreMessagingScheduler"/> class.</summary>
 /// <param name="objScheduleHistoryItem">The object schedule history item.</param>
 public CoreMessagingScheduler(ScheduleHistoryItem objScheduleHistoryItem)
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #31
0
        public override void UpdateSchedule( ScheduleItem objScheduleItem )
        {
            Scheduler.CoreScheduler.RemoveFromScheduleQueue( objScheduleItem );

            SchedulingController s = new SchedulingController();
            s.UpdateSchedule( objScheduleItem.ScheduleID, objScheduleItem.TypeFullName, objScheduleItem.TimeLapse, objScheduleItem.TimeLapseMeasurement, objScheduleItem.RetryTimeLapse, objScheduleItem.RetryTimeLapseMeasurement, objScheduleItem.RetainHistoryNum, objScheduleItem.AttachToEvent, objScheduleItem.CatchUpEnabled, objScheduleItem.Enabled, objScheduleItem.ObjectDependencies, objScheduleItem.Servers );

            ScheduleHistoryItem objScheduleHistoryItem = new ScheduleHistoryItem( objScheduleItem );

            if( objScheduleHistoryItem.TimeLapse != Null.NullInteger && objScheduleHistoryItem.TimeLapseMeasurement != Null.NullString && objScheduleHistoryItem.Enabled )
            {
                objScheduleHistoryItem.ScheduleSource = ScheduleSource.STARTED_FROM_SCHEDULE_CHANGE;
                Scheduler.CoreScheduler.AddToScheduleQueue( objScheduleHistoryItem );
            }
            DataCache.RemoveCache( "ScheduleLastPolled" );
        }
コード例 #32
0
 public PurgeCache(ScheduleHistoryItem objScheduleHistoryItem)
     : base()
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #33
0
        public void RunSingleTask( ScheduleItem s )
        {
            numberOfProcessesInQueue++;
            numberOfProcesses++;
            ScheduleHistoryItem obj = new ScheduleHistoryItem();
            obj.TypeFullName = s.TypeFullName;
            obj.ScheduleID = s.ScheduleID;
            obj.TimeLapse = s.TimeLapse;
            obj.TimeLapseMeasurement = s.TimeLapseMeasurement;
            obj.RetryTimeLapse = s.RetryTimeLapse;
            obj.RetryTimeLapseMeasurement = s.RetryTimeLapseMeasurement;
            obj.ObjectDependencies = s.ObjectDependencies;
            obj.CatchUpEnabled = s.CatchUpEnabled;
            obj.Enabled = s.Enabled;
            obj.NextStart = s.NextStart;
            obj.ScheduleSource = s.ScheduleSource;
            obj.ThreadID = s.ThreadID;
            obj.ProcessGroup = s.ProcessGroup;

            try
            {
                Run( obj );
                Thread.Sleep( 1000 );
            }
            catch( Exception exc )
            {
                Exceptions.Exceptions.ProcessSchedulerException( exc );
            }
        }
コード例 #34
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
            public static void LoadQueueFromTimer()
            {
                _forceReloadSchedule = false;

                List<ScheduleItem> schedule = SchedulingController.GetSchedule(ServerController.GetExecutingServerName());

                foreach (ScheduleItem scheduleItem in schedule)
                {
                    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);
                    }
                }
            }
コード例 #35
0
ファイル: Scheduler.cs プロジェクト: biganth/Curt
            public static ScheduleHistoryItem AddScheduleHistory(ScheduleHistoryItem scheduleHistoryItem)
            {
                try
                {
                    int scheduleHistoryID = SchedulingController.AddScheduleHistory(scheduleHistoryItem);
                    scheduleHistoryItem.ScheduleHistoryID = scheduleHistoryID;
                }
                catch (Exception exc)
                {
                    Exceptions.Exceptions.ProcessSchedulerException(exc);
                }

                return scheduleHistoryItem;
            }
コード例 #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PurgeDeletedUsers"/> class.
 /// </summary>
 /// <param name="objScheduleHistoryItem"></param>
 public PurgeDeletedUsers(ScheduleHistoryItem objScheduleHistoryItem)
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #37
0
 public ConferenceService(ScheduleHistoryItem historyItem)
 {
     ScheduleHistoryItem = historyItem;
 }
コード例 #38
0
 public SendLogNotifications(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #39
0
 public PurgeLogBuffer(ScheduleHistoryItem objScheduleHistoryItem)
     : base()
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #40
0
 public PurgeSiteLog(ScheduleHistoryItem objScheduleHistoryItem)
 {
     this.ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #41
0
ファイル: Scheduler.cs プロジェクト: huayang912/cs-dotnetnuke
            public static ScheduleHistoryItem AddScheduleHistory( ScheduleHistoryItem objScheduleHistoryItem )
            {
                try
                {
                    SchedulingController controller = new SchedulingController();
                    int historyID = controller.AddScheduleHistory( objScheduleHistoryItem );

                    objScheduleHistoryItem.ScheduleHistoryID = historyID;
                }
                catch( Exception exc )
                {
                    Exceptions.Exceptions.ProcessSchedulerException( exc );
                }
                return objScheduleHistoryItem;
            }
コード例 #42
0
ファイル: PurgeOutputCache.cs プロジェクト: misterPaul0/Curt
 public PurgeOutputCache(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem; //REQUIRED
 }
コード例 #43
0
ファイル: Scheduler.cs プロジェクト: huayang912/cs-dotnetnuke
 public static void UpdateScheduleHistory( ScheduleHistoryItem objScheduleHistoryItem )
 {
     try
     {
         SchedulingController controller = new SchedulingController();
         controller.UpdateScheduleHistory( objScheduleHistoryItem );
     }
     catch( Exception exc )
     {
         Exceptions.Exceptions.ProcessSchedulerException( exc );
     }
 }
 public SynchronizeFileSystem(ScheduleHistoryItem objScheduleHistoryItem)
 {
     ScheduleHistoryItem = objScheduleHistoryItem;
 }
コード例 #45
0
ファイル: Scheduler.cs プロジェクト: huayang912/cs-dotnetnuke
 ///''''''''''''''''''''''''''''''''''''''''''''''''
 //This is a multi-thread safe method that adds
 //an item to the collection of schedule items in
 //queue.  It first obtains a write lock
 //on the ScheduleQueue object.
 ///''''''''''''''''''''''''''''''''''''''''''''''''
 public static void AddToScheduleQueue( ScheduleHistoryItem objScheduleHistoryItem )
 {
     if( ! ScheduleQueueContains( objScheduleHistoryItem ) )
     {
         try
         {
             objQueueReadWriteLock.AcquireWriterLock( WriteTimeout );
             try
             {
                 // It is safe for this thread to read or write
                 // from the shared resource.
                 ScheduleQueue.Add( objScheduleHistoryItem);//, objScheduleHistoryItem.ScheduleID.ToString(), null, null );
                 Interlocked.Increment( ref Writes );
             }
             finally
             {
                 // Ensure that the lock is released.
                 objQueueReadWriteLock.ReleaseWriterLock();
             }
         }
         catch( ApplicationException ex )
         {
             // The writer lock request timed out.
             Interlocked.Increment( ref WriterTimeouts );
             Exceptions.Exceptions.LogException( ex );
         }
     }
 }
コード例 #46
0
 /// <summary>This method must save search documents in batches to minimize memory usage instead of returning all documents at once.</summary>
 /// <param name="portalId">ID of the portal for which to index items</param>
 /// <param name="startDateLocal">Minimum modification date of items that need to be indexed</param>
 /// <param name="indexer">A delegate function to send the collection of documents to for saving/indexing</param>
 /// <returns>The number of documents indexed</returns>
 public virtual int IndexSearchDocuments(int portalId,
                                         ScheduleHistoryItem schedule, DateTime startDateLocal, Action <IEnumerable <SearchDocument> > indexer)
 {
     throw new NotImplementedException();
 }
コード例 #47
0
ファイル: ProcessGroup.cs プロジェクト: biganth/Curt
 //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 = RunPooledThread;
         //And put in a request to ThreadPool to run the process.
         ThreadPool.QueueUserWorkItem(callback, obj);
         Thread.Sleep(1000);
     }
     catch (Exception exc)
     {
         Exceptions.Exceptions.ProcessSchedulerException(exc);
     }
 }
コード例 #48
0
 internal SearchEngine(ScheduleHistoryItem scheduler, DateTime startTime)
 {
     SchedulerItem     = scheduler;
     IndexingStartTime = startTime;
 }
コード例 #49
0
 public int AddScheduleHistory( ScheduleHistoryItem objScheduleHistoryItem )
 {
     return DataProvider.Instance().AddScheduleHistory( objScheduleHistoryItem.ScheduleID, objScheduleHistoryItem.StartDate, Globals.ServerName );
 }