protected internal virtual void startAgents(ArrayList agentList)
        {
            int count = agentList.Count;

            for (int i = 0; i < count; i++)
            {
                Props  agentInfo = (Props)agentList[i];
                string str       = agentInfo.getString("agent_id") + "_" + agentInfo.getString("name");
                if (agentInfo.getBoolean("startup"))
                {
                    AgentControllerInterface objectRef = NK.neokernel.createAgent(agentInfo);
                    if (objectRef != null)
                    {
                        try
                        {
                            objectRef.start();
                        }
                        catch (Exception)
                        {
                            NK.DefaultReporter.error(objectRef, "Couldn't start agent " + agentInfo.getString("classname"));
                            Thread.Sleep(0x1388);
                        }
                    }
                }
                else
                {
                    this.debug("Skipping: " + str);
                }
            }
        }
Example #2
0
        public override void start()
        {
            println("Begin ScheduleTaskFactoryAgent");

            try
            {
                ProgramHelper.InitProgram();

                IList <ServerTaskScheduleInfo> list = ADInfoBll.Instance.GetInfos <ServerTaskScheduleInfo>();
                foreach (ServerTaskScheduleInfo i in list)
                {
                    Props agentInfo = new Props();
                    agentInfo.setProperty("classname", "Feng.NeoKernel.Agent.ScheduleTaskAgent");
                    agentInfo.setProperty("startup", true);
                    agentInfo.setProperty("hide_println", false);
                    agentInfo.setProperty("hide_debug", false);
                    agentInfo.setProperty("hide_warning", false);
                    agentInfo.setProperty("startup", true);
                    agentInfo.setProperty("schedule", i.Schedule);
                    agentInfo.setProperty("process", i.Process.Name);
                    agentInfo.setProperty("startAtStart", i.StartAtStart);

                    AgentControllerInterface interface2 = NK.neokernel.createAgent(agentInfo);
                    if (interface2 != null)
                    {
                        interface2.start();

                        println(i.Name + " Schedule Agent is created!");
                    }
                    else
                    {
                        warning(i.Name + " Schedule Agent is not created!");
                    }
                }
            }
            catch (Exception ex)
            {
                println("Error :" + ex.Message);
            }

            println("End ScheduleTaskFactoryAgent");
        }
        internal bool sT()
        {
            Props agentInfo = new Props();

            agentInfo.setProperty("classname", "com.neokernel.nk.Trmntr");
            agentInfo.setProperty("startup", true);
            agentInfo.setProperty("seconds_to_live", 240);
            agentInfo.setProperty("hide_println", true);
            agentInfo.setProperty("hide_debug", true);
            agentInfo.setProperty("hide_warning", true);
            AgentControllerInterface interface2 = NK.neokernel.createAgent(agentInfo);

            if (interface2 != null)
            {
                this.complain("*** The server will stop in 5 minutes because no valid license was found. Please obtain a current license to continue using this software.");
                interface2.start();
                return(true);
            }
            this.complain("License problem.");
            return(false);
        }