Changeset 1728


Ignore:
Timestamp:
04/30/09 15:31:47 (12 years ago)
Author:
kgrading
Message:

implemented persistance for list (#493)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/JobStorage/JobStorageManager.cs

    r1449 r1728  
    88using HeuristicLab.Hive.Client.Core.ConfigurationManager;
    99using HeuristicLab.Hive.Contracts;
     10using System.Xml.Serialization;
    1011
    1112namespace HeuristicLab.Hive.Client.Core.JobStorage {
     
    1920    public static void PersistObjectToDisc(String serverIP, long serverPort, Guid jobId, byte[] job) {
    2021      String filename = serverIP + "." + serverPort + "." + jobId.ToString();
     22      JobStorageInfo info = new JobStorageInfo { JobID = jobId, ServerIP = serverIP, ServerPort = serverPort, TimeFinished = DateTime.Now };
    2123
    22       JobStorageInfo info = new JobStorageInfo { JobID = jobId, ServerIP = serverIP, ServerPort = serverPort, TimeFinished = DateTime.Now };
     24      if (!Directory.Exists(path))
     25        Directory.CreateDirectory(path);
    2326           
    2427      Stream jobstream = null;
     
    3639          jobstream.Close();
    3740      }
     41
     42      StoreJobList();
     43
    3844    }
    3945
     
    5460           
    5561       //   }
     62          }
    5663        }
    57       }
    5864    }
     65
     66    public static void StoreJobList() {
     67      XmlSerializer serializer = new XmlSerializer(typeof(List<JobStorageInfo>));
     68      TextWriter writer = new StreamWriter(path + "list.xml");
     69      serializer.Serialize(writer, storedJobsList);
     70    }
     71   
    5972  }
    6073}
Note: See TracChangeset for help on using the changeset viewer.