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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r6764 r6893  
    446446
    447447    #region Slave Methods
     448    public int GetNewHeartbeatInterval(Guid slaveId) {
     449      authen.AuthenticateForAnyRole(HiveRoles.Slave);
     450      Slave s = dao.GetSlave(slaveId);
     451      if (s != null) {
     452        return s.HbInterval;
     453      } else {
     454        return -1;
     455      }
     456    }
     457
    448458    public Guid AddSlave(Slave slave) {
    449459      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
     
    486496      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    487497      trans.UseTransaction(() => {
    488         dao.UpdateSlaveGroup(slaveGroup);
    489       });
     498        UpdateSlaveHBs(slaveGroup);
     499      });
     500    }
     501
     502    private void UpdateSlaveHBs(Resource r) {
     503      foreach (Resource resource in dao.GetChildResources(r.Id)) {
     504        if (resource is SlaveGroup) {
     505          resource.HbInterval = r.HbInterval;
     506          dao.UpdateSlaveGroup(resource as SlaveGroup);
     507          UpdateSlaveHBs(resource);
     508        } else if (resource is Slave) {
     509          resource.HbInterval = r.HbInterval;
     510          dao.UpdateSlave(resource as Slave);
     511        }
     512      }
    490513    }
    491514
Note: See TracChangeset for help on using the changeset viewer.