Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/09/11 01:47:51 (13 years ago)
Author:
ascheibe
Message:

#1233 server can now control the slave heartbeat interval

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs

    r6863 r6893  
    189189            wcfService.Connect(configManager.GetClientInfo());
    190190            break;
     191          case MessageContainer.MessageType.NewHBInterval:
     192            int interval = wcfService.GetNewHeartbeatInterval(ConfigManager.Instance.GetClientInfo().Id);
     193            if (interval != -1) {
     194              HeartbeatManager.Interval = TimeSpan.FromSeconds(interval);
     195            }
     196            break;
    191197        }
    192198      } else {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/HeartbeatManager.cs

    r6464 r6893  
    3333  public class HeartbeatManager {
    3434    private static object locker = new object();
    35     public TimeSpan Interval { get; set; }
     35    private TimeSpan interval;
     36
     37    public TimeSpan Interval {
     38      get { return interval; }
     39      set {
     40        interval = value;
     41        Settings.Default.HeartbeatInterval = interval;
     42        Settings.Default.Save();
     43      }
     44    }
    3645    private Thread heartBeatThread;
    3746    private AutoResetEvent waitHandle;
     
    4049
    4150    public HeartbeatManager() {
    42       Interval = Settings.Default.HeartbeatInterval;
     51      interval = Settings.Default.HeartbeatInterval;
    4352    }
    4453
     
    91100                CpuUtilization = ConfigManager.Instance.GetCpuUtilization(),
    92101                JobProgress = ConfigManager.Instance.GetExecutionTimeOfAllJobs(),
    93                 AssignJob = !ConfigManager.Instance.Asleep
     102                AssignJob = !ConfigManager.Instance.Asleep,
     103                HbInterval = (int)interval.TotalSeconds
    94104              };
    95105
     
    112122          OnExceptionOccured(e);
    113123        }
    114         waitHandle.WaitOne(this.Interval);
     124        waitHandle.WaitOne(this.interval);
    115125      }
    116126      waitHandle.Close();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/WcfService.cs

    r6744 r6893  
    144144    }
    145145
     146    public int GetNewHeartbeatInterval(Guid id) {
     147      int ret = -1;
     148      CallHiveService(s => ret = s.GetNewHeartbeatInterval(id));
     149      return ret;
     150    }
     151
    146152    /// <summary>
    147153    /// Network communication error handler.
Note: See TracChangeset for help on using the changeset viewer.