クライアント側のIISに常駐するプロキシWCFサービスがあり、外部WCFサービス(Windowsサービスによって呼び出されます)に呼び出しを行います。統計は Windows サービスから収集されるため、次の m_statList ディクショナリに格納されます。
public static Dictionary<int, LinkedList<StatValue>> m_statList = new Dictionary<int, LinkedList<StatValue>>();
public static Dictionary<int, LinkedList<StatValue>> Stats
{
get
{
return m_statList;
}
}
m_statList は、サービスの実行中に値を保持しますが、プロキシが m_statList で呼び出しを行うと、カウントはゼロに設定されます。
内部プロキシ サービスからの呼び出し方法は次のとおりです。
public Dictionary<int, List<StatValue>> GetStats(DateTime getFromDate, List<int> getValueList)
{
Dictionary<int, List<StatValue>> returnList = new Dictionary<int, List<StatValue>>();
foreach (var stat in DashboardCollectorService.Stats.Where(k => getValueList.Contains(k.Key)))
{
returnList.Add(stat.Key, stat.Value.Where(s => s.StatDateTime > getFromDate).ToList<StatValue>());
}
return returnList;
}
プロキシから統計を呼び出したときに m_statList が空かどうかわかりません。
public class DashboardProxyService : IDashboardWCFService
{
DashboardWCFService buffer = new DashboardWCFService();
Dictionary<int, List<StatValue>> IDashboardWCFService.GetStats(DateTime getFromDate, List<int> getValueList)
{
return buffer.GetStats(getFromDate, getValueList);
}
List<StatType> IDashboardWCFService.GetStatTypes()
{
return buffer.GetStatTypes();
}
}