public SummaryDataPageResponse <BackstageJob> Report(BackstageJobSearchModel searchModel)
        {
            var predicate = search(searchModel);

            var query = GetDefaultQuery().Where(predicate);

            var count = query.Count();

            var group_data = query.GroupBy(x => x.Action)
                             .Select(x => new JobGroupState
            {
                Action = x.Key,
                Count  = x.Count()
            }).ToArray();

            query = ApplySortingRule(query, searchModel, x => x.BackstageJobPK);
            query = ApplyPagingRule(query, searchModel);

            var brokers = ObjectRegistry.GetObjects <IJobServiceBroker>();
            BackstageJobThreadState state = null;

            if (brokers.Any())
            {
                var broker = brokers.First();
                state           = broker.GetState();
                state.JobGroups = group_data;
            }

            return(new SummaryDataPageResponse <BackstageJob>(query.ToList(), searchModel.PageNumber, count, false)
            {
                Summary = state
            });
        }
Example #2
0
        public BackstageJobThreadState GetState()
        {
            var state = new BackstageJobThreadState();
            int workerThreads, completionPortThreads;

            ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads);
            state.AvailableThreads = workerThreads;
            ThreadPool.GetMaxThreads(out workerThreads, out completionPortThreads);
            state.MaxThreads = workerThreads;
            ThreadPool.GetMinThreads(out workerThreads, out completionPortThreads);
            state.MinThreads = workerThreads;
            if (Program.ServiceInstance != null)
            {
                state.QueueState = String.Join(Environment.NewLine, Program.ServiceInstance.Queue.Select(x => String.Join("=", new string[] { x.Key, x.Value.ToString() })));
            }
            return(state);
        }