Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/06/08 12:22:58 (16 years ago)
Author:
gkronber
Message:
  • extracted communication code out of the DistributedEngine into class JobManager
  • implemented a method to retrieve the JobState for a given job (specified by it's guid) in GridServer
  • implemented restarting of jobs in JobManager
  • improved exception handling in JobManager and DistributedEngine

(ticket #136)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Grid/ClientForm.cs

    r115 r219  
    4646    private ProcessingEngine currentEngine;
    4747    private string clientUrl;
    48     private object locker = new object();
    4948
    5049    public ClientForm() {
     
    6261
    6362      // windows XP returns the external ip on index 0 while windows vista returns the external ip on index 2
    64       if (System.Environment.OSVersion.Version.Major >= 6) {
    65         clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":" + clientPort.Text +"/Grid/Client";
     63      if(System.Environment.OSVersion.Version.Major >= 6) {
     64        clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":" + clientPort.Text + "/Grid/Client";
    6665      } else {
    67         clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":" + clientPort.Text +"/Grid/Client";
     66        clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":" + clientPort.Text + "/Grid/Client";
    6867      }
    6968
     
    8786        statusTextBox.Text = "Waiting for engine";
    8887
    89       } catch (CommunicationException ex) {
     88      } catch(CommunicationException ex) {
    9089        MessageBox.Show("Exception while connecting to the server: " + ex.Message);
    9190        clientHost.Abort();
     
    106105
    107106    private void fetchOperationTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    108       lock(locker) {
    109         byte[] engineXml;
    110         fetchOperationTimer.Stop();
    111         if(engineStore.TryTakeEngine(clientUrl, out currentGuid, out engineXml)) {
     107      byte[] engineXml;
     108      fetchOperationTimer.Stop();
     109      try {
     110        if(engineStore.TryTakeEngine(out currentGuid, out engineXml)) {
    112111          currentEngine = RestoreEngine(engineXml);
    113112          if(InvokeRequired) { Invoke((MethodInvoker)delegate() { statusTextBox.Text = "Executing engine"; }); } else statusTextBox.Text = "Executing engine";
     
    126125          fetchOperationTimer.Start();
    127126        }
     127      } catch(Exception ex) {
     128        currentEngine = null;
     129        currentGuid = Guid.Empty;
     130        fetchOperationTimer.Interval = 5000;
     131        fetchOperationTimer.Start();
    128132      }
    129133    }
    130134    public void Abort(Guid guid) {
    131       lock(locker) {
    132         if(!IsRunningEngine(guid)) return;
    133         currentEngine.Abort();
    134       }
     135      throw new NotSupportedException();
    135136    }
    136137    public bool IsRunningEngine(Guid guid) {
    137       return currentGuid == guid;
     138      throw new NotSupportedException();
    138139    }
    139140    private ProcessingEngine RestoreEngine(byte[] engine) {
Note: See TracChangeset for help on using the changeset viewer.