Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/08 16:09:10 (17 years ago)
Author:
gkronber
Message:
  • added statement to remove results from the job-manager
  • added a critical section in case EndExecuteOperation is called while any of the TryGetResult-threads is still running.
  • added statements to make sure that streams to (un)zip serialized engines are closed and resources released

(ticket #149)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DistributedEngine/JobManager.cs

    r253 r256  
    6565      stream.Close();
    6666      byte[] zippedEngine = memStream.ToArray();
     67      memStream.Close();
    6768      Guid currentEngineGuid = Guid.Empty;
    6869      bool success = false;
     
    102103
    103104    public IScope EndExecuteOperation(AtomicOperation operation) {
    104       byte[] zippedResult = results[operation];
     105      byte[] zippedResult = null;
     106      lock(dictionaryLock) {
     107        zippedResult = results[operation];
     108        results.Remove(operation);
     109      }
    105110      // restore the engine
    106       GZipStream stream = new GZipStream(new MemoryStream(zippedResult), CompressionMode.Decompress);
    107       ProcessingEngine resultEngine = (ProcessingEngine)PersistenceManager.Load(stream);
    108 
    109       return resultEngine.InitialOperation.Scope;
     111      using(GZipStream stream = new GZipStream(new MemoryStream(zippedResult), CompressionMode.Decompress)) {
     112        ProcessingEngine resultEngine = (ProcessingEngine)PersistenceManager.Load(stream);
     113        return resultEngine.InitialOperation.Scope;
     114      }     
    110115    }
    111116
Note: See TracChangeset for help on using the changeset viewer.