Exemplo n.º 1
0
        static void Main(string[] args)
        {
            AnekaApplication <AnekaThread, ThreadManager> app = null;

            while (true)
            {
                try
                {
                    // Aneka Configuration
                    Logger.Start();
                    Configuration conf = Configuration.GetConfiguration(@"C:\xampp\htdocs\EdgeLens\Aneka\conf.xml");
                    app = new AnekaApplication <AnekaThread, ThreadManager>(conf);

                    // Wait for input
                    while (!File.Exists(input))
                    {
                        Console.WriteLine("Waiting for input");
                        System.Threading.Thread.Sleep(1000);
                    }

                    HelloWorld  hw = new HelloWorld(masterIP);
                    AnekaThread th = new AnekaThread(hw.PrintHello, app);
                    th.Start();
                    th.Join();
                    hw = (HelloWorld)th.Target;
                    Console.WriteLine("Job done");
                    File.Delete(input);
                }
                finally
                {
                    app.StopExecution();
                    Logger.Stop();
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            AnekaApplication <AnekaThread, ThreadManager> app = null;

            try
            {
                Logger.Start();
                Configuration conf = Configuration.GetConfiguration("C:/Aneka/conf.xml");

                app = new AnekaApplication <AnekaThread, ThreadManager>(conf);
                HelloWorld  hw = new HelloWorld();
                AnekaThread th = new AnekaThread(hw.PrintHello, app);
                th.Start();
                th.Join();
                hw = (HelloWorld)th.Target;
                Console.WriteLine("Value: " + hw.result);
            }
            finally
            {
                app.StopExecution();
                Logger.Stop();
            }
        }