Ignore:
Timestamp:
01/14/09 16:16:21 (12 years ago)
Author:
msteinbi
Message:

Add licencse information where missing, added method description comments (#466)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r1120 r1121  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
     
    1839  /// </summary>
    1940  public class ClientCommunicator: IClientCommunicator {
    20     int nrOfJobs = 0;
    2141    Dictionary<Guid, DateTime> lastHeartbeats =
    2242      new Dictionary<Guid,DateTime>();
     
    2747    ILifecycleManager lifecycleManager;
    2848
     49    /// <summary>
     50    /// Initialization of the Adapters to the database
     51    /// Initialization of Eventhandler for the lifecycle management
     52    /// Initialization of lastHearbeats Dictionary
     53    /// </summary>
    2954    public ClientCommunicator() {
    3055      clientAdapter = ServiceLocator.GetClientAdapter();
     
    3661        new EventHandler(lifecycleManager_OnServerHeartbeat);
    3762
    38       for (int i = 0; i < nrOfJobs; i++) {
    39         Job job = new Job();
    40         job.Id = i;
    41         job.State = State.offline;
    42         jobAdapter.Update(job);
    43       }
    4463      lastHeartbeats = new Dictionary<Guid, DateTime>();
    45 
    46     }
    47 
     64    }
     65
     66    /// <summary>
     67    /// Check if online clients send their hearbeats
     68    /// if not -> set them offline and check if they where calculating a job
     69    /// </summary>
     70    /// <param name="sender"></param>
     71    /// <param name="e"></param>
    4872    [MethodImpl(MethodImplOptions.Synchronized)]
    4973    void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) {
     
    89113    #region IClientCommunicator Members
    90114
     115    /// <summary>
     116    /// Login process for the client
     117    /// A hearbeat entry is created as well (login is the first hearbeat)
     118    /// </summary>
     119    /// <param name="clientInfo"></param>
     120    /// <returns></returns>
    91121    [MethodImpl(MethodImplOptions.Synchronized)]
    92122    public Response Login(ClientInfo clientInfo) {
     
    114144    }
    115145
     146    /// <summary>
     147    /// The client has to send regulary heartbeats
     148    /// this hearbeats will be stored in the heartbeats dictionary
     149    /// check if there is work for the client and send the client a response if he should pull a job
     150    /// </summary>
     151    /// <param name="hbData"></param>
     152    /// <returns></returns>
    116153    [MethodImpl(MethodImplOptions.Synchronized)]
    117154    public ResponseHB SendHeartBeat(HeartBeatData hbData) {
     
    143180      return response;
    144181    }
    145 
     182   
     183    /// <summary>
     184    /// if the client asked to pull a job he calls this method
     185    /// the server selects a job and sends it to the client
     186    /// </summary>
     187    /// <param name="clientId"></param>
     188    /// <returns></returns>
    146189    [MethodImpl(MethodImplOptions.Synchronized)]
    147190    public ResponseJob PullJob(Guid clientId) {
     
    164207    }
    165208
     209    /// <summary>
     210    /// the client can send job results during calculating
     211    /// and will send a final job result when he finished calculating
     212    /// these job results will be stored in the database
     213    /// </summary>
     214    /// <param name="clientId"></param>
     215    /// <param name="jobId"></param>
     216    /// <param name="result"></param>
     217    /// <param name="exception"></param>
     218    /// <param name="finished"></param>
     219    /// <returns></returns>
    166220    [MethodImpl(MethodImplOptions.Synchronized)]
    167221    public ResponseResultReceived SendJobResult(Guid clientId,
     
    211265    }
    212266
     267    /// <summary>
     268    /// when a client logs out the state will be set
     269    /// and the entry in the last hearbeats dictionary will be removed
     270    /// </summary>
     271    /// <param name="clientId"></param>
     272    /// <returns></returns>
    213273    [MethodImpl(MethodImplOptions.Synchronized)]                       
    214274    public Response Logout(Guid clientId) {
Note: See TracChangeset for help on using the changeset viewer.