Exemplo n.º 1
0
        /// <summary>
        /// starts database workers that handle queue's
        /// </summary>
        public void StartRlmDbWorkers()
        {
            //note: we can start multiple workers later
            rlmDb.StartSessionWorkerForCreate(bcSessionsToCreate, workerTokenSrc.Token);                                                                                              //start session thread for create
            Task.Factory.StartNew(() => { rlmDbEnqueuer.QueueObjects <Session>(SessionsQueueToCreate, bcSessionsToCreate, workerTokenSrc.Token); }, TaskCreationOptions.LongRunning); //queue sessions for create to blocking collections

            rlmDb.StartSessionWorkerForUpdate(bcSessionsToUpdate, workerTokenSrc.Token);                                                                                              //start session thread for update
            Task.Factory.StartNew(() => { rlmDbEnqueuer.QueueObjects <Session>(SessionsQueueToUpdate, bcSessionsToUpdate, workerTokenSrc.Token); }, TaskCreationOptions.LongRunning); //queue sessions for update to blocking collections

            rlmDb.StartCaseWorker(bcCasesQueue, workerTokenSrc.Token);                                                                                                                //start case thread to save (Rneuron, Solution, Case) to db
            Task.Factory.StartNew(() => { rlmDbEnqueuer.QueueObjects(MASTER_CASE_QUEUE, bcCasesQueue, caseQueue_lock, workerTokenSrc.Token); }, TaskCreationOptions.LongRunning);

            progressUpdater.Start();
        }
        /// <summary>
        /// starts database workers that handle queue's
        /// </summary>
        public void StartRlmDbWorkers()
        {
            //note: we can start multiple workers later
            sessionCreateTask = rlmDb.StartSessionWorkerForCreate(session_queue, tokenSessions);      //start session thread for create
            Task.Run(() => { rlmDbEnqueuer.QueueObjects <Session>(Sessions2, session_queue); });      //queue sessions for create to blocking collections

            sessionUpdateTask = rlmDb.StartSessionWorkerForUpdate(savedSession_queue, tokenSessions); //start session thread for update
            Task.Run(() => { rlmDbEnqueuer.QueueObjects <Session>(Sessions3, savedSession_queue); }); //queue sessions for update to blocking collections

            caseTask = rlmDb.StartCaseWorker(case_queue, tokenCases);                                 //start case thread to save (Rneuron, Solution, Case) to db
            Task.Run(() => { rlmDbEnqueuer.QueueObjects <Case>(Cases2, case_queue); });               //queue case values to blocking collections

            progressUpdater.Start();

            //rnnDb.StartCaseWorker(tokenCases);
        }