Ejemplo n.º 1
0
        /// <summary>
        /// Get the scheduler, using a singleton pattern.
        /// </summary>
        /// <param name="applicationMapPath">
        /// usually HttpContext.Current.Server.MapPath(PortalSettings.ApplicationPath)
        /// </param>
        /// <param name="connection">
        /// db connection
        /// </param>
        /// <param name="period">
        /// scheduler timer milliseconds
        /// </param>
        /// <param name="cacheSize">
        /// max number of in-memory tasks
        /// </param>
        /// <returns>
        /// </returns>
        public static CachedScheduler GetScheduler(
            string applicationMapPath, IDbConnection connection, long period, int cacheSize)
        {
            // Singleton
            if (theScheduler == null)
            {
                lock (loadSchedCache)
                {
                    if (theScheduler == null)
                    {
                        theScheduler = new CachedScheduler(applicationMapPath, connection, period, cacheSize);
                    }
                }
            }

            return(theScheduler);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the scheduler, using a singleton pattern.
        /// </summary>
        /// <param name="applicationMapPath">
        /// usually HttpContext.Current.Server.MapPath(PortalSettings.ApplicationPath)
        /// </param>
        /// <param name="connection">
        /// db connection
        /// </param>
        /// <param name="period">
        /// scheduler timer milliseconds
        /// </param>
        /// <param name="cacheSize">
        /// max number of in-memory tasks
        /// </param>
        /// <returns>
        /// </returns>
        public static CachedScheduler GetScheduler(
            string applicationMapPath, IDbConnection connection, long period, int cacheSize)
        {
            // Singleton
            if (theScheduler == null)
            {
                lock (typeof(CachedScheduler))
                {
                    if (theScheduler == null)
                    {
                        theScheduler = new CachedScheduler(applicationMapPath, connection, period, cacheSize);
                    }
                }
            }

            return theScheduler;
        }