예제 #1
0
        /// <summary>
        /// Get the score for a set of comma separated hashtags
        /// </summary>
        /// <param name="hashtags"></param>
        /// <returns></returns>
        public async Task <ActionResult> GetScores(string hashtags)
        {
            // get a handle the to dispatcher grain
            var tweetGrain = TweetDispatcherGrainFactory.GetGrain(0);

            // get the scores for the hashtags
            var tweetGrainTask = tweetGrain.GetTotals(hashtags.ToLower().Split(','));

            // get a handle the to counter grain
            var counterGrain = CounterFactory.GetGrain(0);

            // get the total number of hashtag activations
            var counterGrainTask = counterGrain.GetTotalCounter();

            // wait for tasks to complete
            await Task.WhenAll(tweetGrainTask, counterGrainTask);

            // return the json
            return(Json(new object[] { tweetGrainTask.Result, counterGrainTask.Result }, JsonRequestBehavior.AllowGet));
        }
 /// <summary>
 /// Loads instances that are used in performance counter computation.
 /// </summary>
 public void LoadDependentInstances()
 {
     this.factory = new CounterFactory();
 }
예제 #3
0
 protected override Counter GetCounter()
 {
     return(CounterFactory.GetCounter(typeof(iText.Pdfa.PdfADocument)));
 }