Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/05/09 14:40:53 (15 years ago)
Author:
kgrading
Message:

added calendar behavior in the whole application (#669)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Heartbeat.cs

    r1936 r2025  
    3939  /// </summary>
    4040  public class Heartbeat {
     41
     42    private bool offline;
     43
    4144    public double Interval { get; set; }   
    4245    private Timer heartbeatTimer = null;
     
    7275    void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) {
    7376      Console.WriteLine("tick"); 
    74       ClientInfo info = ConfigManager.Instance.GetClientInfo();
    75       // Todo: remove tempfix for free cores.
     77      ClientInfo info = ConfigManager.Instance.GetClientInfo();     
    7678
    7779      PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true);
    7880      int mb = (int)(counter.NextValue() / 1024 / 1024);
    79 
    80      
    8181
    8282      HeartBeatData heartBeatData = new HeartBeatData {
     
    8484        FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(),
    8585        FreeMemory = mb,
    86         JobProgress = ConfigManager.Instance.GetProgressOfAllJobs()
     86        JobProgress = ConfigManager.Instance.GetProgressOfAllJobs()     
    8787      };
     88     
     89      DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00");
     90      TimeSpan span = DateTime.Now - lastFullHour;
     91      if (span.TotalSeconds < (Interval/1000)) {
     92        if (UptimeManager.Instance.isOnline()) {
     93          //That's quiet simple: Just reconnect and you're good for new jobs
     94          if (wcfService.ConnState != NetworkEnum.WcfConnState.Connected) {
     95            Logging.Instance.Info(this.ToString(), "Client goes online according to timetable");
     96            wcfService.Connect();
     97          }
     98        } else {
     99          //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong
     100          MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect);                 
     101        }       
     102      }
    88103      if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) {
    89104        wcfService.Connect();
Note: See TracChangeset for help on using the changeset viewer.