using System; using System.Net; using System.Threading; using HeuristicLab.Clients.Hive.SlaveCore; using Microsoft.WindowsAzure.Diagnostics; using Microsoft.WindowsAzure.ServiceRuntime; namespace HeuristicLab.Clients.Hive.Slave.AzureClient { public class WorkerRole : RoleEntryPoint { private Core core; private Thread coreThread; public override void Run() { core = new Core(false); coreThread = new Thread(core.Start); coreThread.Start(); while (true) { Thread.Sleep(10000); //Trace.WriteLine("Working", "Information"); } } public override bool OnStart() { ServicePointManager.DefaultConnectionLimit = 12; core = new Core(); DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration(); dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose; DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmc); return base.OnStart(); } public override void OnStop() { core.Shutdown(); base.OnStop(); } } }