コード例 #1
0
ファイル: WorkerRole.cs プロジェクト: sivethe/demo
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=166357.

            //Initialize latency result store
            this.resultStore = new LatencyResultStore();

            // Create and initialize worker instances
            //IWorker mongoWorker = new MongoWorker(WorkerSettings.CurrentRegion);
            //mongoWorker.InitializeAsync().Wait();
            IWorker tableNativeWorker = new TableWorker(WorkerSettings.TableNativeConnectionString, WorkerType.TablesNative);

            tableNativeWorker.InitializeAsync().Wait();
            IWorker tablev2Worker = new TableWorker(WorkerSettings.TablePremiumConnectionString, WorkerType.Tablesv2);

            tablev2Worker.InitializeAsync().Wait();

            //Add to list
            //this.workers.Add(mongoWorker);
            this.workers.Add(tableNativeWorker);
            this.workers.Add(tablev2Worker);

            bool result = base.OnStart();

            Trace.TraceInformation("LatencyWorkerRole has been started");
            return(result);
        }
コード例 #2
0
        protected override void OnStart(string[] args)
        {
            operation = new TableWorker();
            Thread serviceThread = new Thread(new ThreadStart(operation.Start));

            serviceThread.Start();
        }