Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/08 18:05:59 (16 years ago)
Author:
kgrading
Message:

work on #385, core problem still exists.

File:
1 edited

Legend:

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

    r797 r805  
    1313  public class ClientCommunicator: IClientCommunicator {
    1414    List<ClientInfo> clients;
    15     List<long> jobs;
     15    LinkedList<long> jobs;
    1616    int nrOfJobs = 10;
    1717
    1818    public ClientCommunicator() {
    19       jobs = new List<long>();
    20       for (int i = 1; i < nrOfJobs; i++) {
    21         jobs.Add(i);
     19      jobs = new LinkedList<long>();
     20      for (long i = 1; i < nrOfJobs; i++) {
     21        jobs.AddFirst(i);
    2222      }
    2323    }
     
    5454    public ResponseJob PullJob(Guid clientId) {
    5555      ResponseJob response = new ResponseJob();
    56 
    57       response.JobId = jobs.ElementAt(jobs.Count);
     56      lock (this) {
     57        response.JobId = jobs.Last.Value;
     58        jobs.RemoveLast();
     59      }
     60     
    5861      response.Success = true;
    59       response.StatusMessage = "Job with id " + jobs.Count + " sent";
    60       jobs.Remove(jobs.Count);
    61 
     62      response.StatusMessage = "Job with id " + jobs.Count + " sent";     
    6263      return response;
    6364    }
     
    7071      return response;
    7172    }
    72 
     73                           
    7374    public Response Logout(Guid clientId) {
    7475      bool clientRemoved = false;
Note: See TracChangeset for help on using the changeset viewer.