Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IBatisNet develop a Web application, in fact, started to automate tasks in multi-threaded processing, processed once every 10 minutes, but the following problem #39

Open
GoogleCodeExporter opened this issue May 26, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

To initialize DaoManager in Global.asax
C # code
protected void Application_start (...) {
   / / Initialize DaoManager
   WZW.IBatisNet.SqlMap.DaoConfig.GetInstance (). InitBaseDaoManager ();

   / / Record system startup log
   Biz.SysLogBiz.GetInstance (). AddLog ("", Const.SYS_LOG_LOG_TYPE_SYSTEM_START, "system startup success!");

   Biz.AutoRunBiz.GetInstance ();

}



Automatic processing procedure is as follows:

C # code
public class AutoRunBiz
    {
        private static AutoRunBiz instance = null;

        public static AutoRunBiz GetInstance ()
        {
            if (instance == null)
            {
                instance = new AutoRunBiz ();
            }
            return the instance;
        }

        public AutoRunBiz ()
        {
            / / Timer is running
            Thread th = new Thread (new ThreadStart (this.Run));
            th.Start ();
        }

        private void Run ()
        {
            while (true)
            {
                Biz.MakePageBiz.GetInstance (). MakeIndex ();

                / / Executed once every 10 minutes
                Thread.Sleep (600000);
            }
        }
    }




Found that the system logs the following questions:

System startup system startup 2009-10-26 19:40:19
System startup system startup 2009-10-26 19:29:56
System startup system startup 2009-10-26 19:19:47

Every 10 minutes will be initialized once DaoManager

Description Global.asax the Application_Start every 10 minutes performed once, 
if not the automatic task processing, only the execution time Application_start

Master please help?

Original issue reported on code.google.com by [email protected] on 3 Feb 2012 at 12:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant