Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/17/10 10:26:55 (14 years ago)
Author:
cneumuel
Message:
  • Refactored HL.Hive.Experiment. JobItems are not called HiveJobs and OptimizerJobs do not contain a hierarchy anymore.
  • Dynamic generation of jobs on a slave are not reflected on the client user interface.
  • Optimizer-Trees are now strictly synchronized with the HiveJob-Trees (also the ComputeInParallel property is taken into account when the Child HiveJobs are created)
  • Improved the way a class can report progress and lock the UI (IProgressReporter, IProgress, Progress, ProgressView)
  • Changes were made to the config-files, so that server and clients work with blade12.hpc.fh-hagenberg.at
  • Lots of small changes and bugfixes
Location:
branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3
Files:
2 added
1 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/ApplicationConstants.cs

    r4264 r4423  
    3939   
    4040    public static int JOB_TIME_TO_LIVE = 5;
     41
     42    /// <summary>
     43    /// Interval in which the HL.HiveExperiment will poll results from server
     44    /// </summary>
     45    public static TimeSpan RESULT_POLLING_INTERVAL = new TimeSpan(0, 0, 5);
     46
     47    /// <summary>
     48    /// Maximum number of jobs that the server should send/receive simultaniously
     49    /// </summary>
     50    public static int MAX_JOB_TRANSFER_COUNT = 6;
    4151  }
    4252}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/HeartBeatData.cs

    r4264 r4423  
    3737    public int FreeCores { get; set; }
    3838    [DataMember]
    39     public Dictionary<Guid, double> JobProgress { get; set; } // TODO: define Type
     39    public Dictionary<Guid, TimeSpan> JobProgress { get; set; } // TODO: define Type
    4040    [DataMember]
    4141    public bool IsAllowedToCalculate { get; set; } // this is true if slave is allowed to work according to calendar
     
    4343    public override string ToString() {
    4444      String val = "SlaveId: " + SlaveId + ", FreeCores: " + FreeCores;
    45       foreach (KeyValuePair<Guid, double> kvp in JobProgress) {
    46         val += "\nId" + kvp.Key + " Progress " + kvp.Value;
     45      foreach (KeyValuePair<Guid, TimeSpan> kvp in JobProgress) {
     46        val += "\nId" + kvp.Key + " ExecutionTime " + kvp.Value;
    4747      }
    4848      return val;
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobDto.cs

    r4368 r4423  
    4141    [Storable]
    4242    [DataMember]
    43     public Guid? UserId { get; set; }
     43    public Guid UserId { get; set; }
    4444    [Storable]
    4545    [DataMember]
     
    4747    [Storable]
    4848    [DataMember]
    49     public JobDto ParentJob { get; set; }
     49    public Guid? ParentJobId { get; set; }
    5050    [Storable]
    5151    [DataMember]
    52     public double? Percentage { get; set; }
     52    public TimeSpan ExecutionTime { get; set; }
    5353    [Storable]
    5454    [DataMember]
     
    104104      clone.Id = this.Id;
    105105      clone.MemoryNeeded = this.MemoryNeeded;
    106       clone.ParentJob = (JobDto)cloner.Clone(this.ParentJob);
    107       clone.Percentage = this.Percentage;
     106      clone.ParentJobId = this.ParentJobId;
     107      clone.ExecutionTime = this.ExecutionTime;
    108108      clone.PluginsNeeded = (from p in this.PluginsNeeded
    109109                             select (HivePluginInfoDto)cloner.Clone(p)).ToList();
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobResult.cs

    r4368 r4423  
    4444    [Storable]
    4545    [DataMember]
    46     public double? Percentage { get; set; }
     46    public TimeSpan ExecutionTime { get; set; }
    4747    [Storable]
    4848    [DataMember]
     
    6868      clone.DateFinished = this.DateFinished;
    6969      clone.Exception = this.Exception;
    70       clone.Percentage = this.Percentage;
     70      clone.ExecutionTime = this.ExecutionTime;
    7171      clone.State = this.State;
    7272      clone.ParentJobId = this.ParentJobId;
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobState.cs

    r4368 r4423  
    66namespace HeuristicLab.Hive.Contracts.BusinessObjects {
    77  public enum JobState {
     8    /// <summary>
     9    /// Job is actively calculated on a Slave
     10    /// </summary>
    811    Calculating,
     12
     13    /// <summary>
     14    /// Job is waiting to be calculated
     15    /// </summary>
    916    Offline,
     17
     18    /// <summary>
     19    /// Job as finished and is ready to be collected by the Client
     20    /// </summary>
    1021    Finished,
     22
     23    /// <summary>
     24    /// Job is aborted and result can be collected by the Client
     25    /// </summary>
    1126    Aborted,
     27
     28    /// <summary>
     29    /// A snapshot has been requested. The calculating slave is responsible for pausing the Job and sending the snapshot to the server. After that state will be SnapshotSent
     30    /// </summary>
    1231    SnapshotRequested,
     32
     33    /// <summary>
     34    /// Snapshot has been sent to the server and its calculating again (should'nt it be back to Calculating again?)
     35    /// </summary>
    1336    SnapshotSent,
     37
     38    /// <summary>
     39    /// ???
     40    /// </summary>
    1441    Pending,
     42
     43    /// <summary>
     44    /// Job as been aborted due to an error. Results are ready to be collected
     45    /// </summary>
    1546    Failed,
     47
     48    /// <summary>
     49    /// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished.
     50    /// </summary>
    1651    WaitForChildJobs
    1752  };
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/SerializedJob.cs

    r4133 r4423  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Common;
     29using System.IO;
     30using HeuristicLab.Persistence.Default.Xml;
     31using HeuristicLab.Hive.JobBase;
    2932
    3033namespace HeuristicLab.Hive.Contracts.BusinessObjects {
     
    5255      return Clone(new Cloner());
    5356    }
     57
     58    public static byte[] Serialize(object obj) {
     59      MemoryStream memStream = new MemoryStream();
     60      XmlGenerator.Serialize(obj, memStream);
     61      byte[] jobByteArray = memStream.ToArray();
     62      memStream.Dispose();
     63      return jobByteArray;
     64    }
     65
     66    public static T Deserialize<T>(byte[] sjob) {
     67      MemoryStream memStream = new MemoryStream(sjob);
     68      T job = XmlParser.Deserialize<T>(memStream);
     69      memStream.Dispose();
     70      return job;
     71    }
    5472  }
    5573}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/SlaveDto.cs

    r4267 r4423  
    3535    [Storable]
    3636    [DataMember]
    37     public int NrOfCores { get; set; }
     37    public int? NrOfCores { get; set; }
    3838    [Storable]
    3939    [DataMember]
    40     public int NrOfFreeCores { get; set; }
     40    public int? NrOfFreeCores { get; set; }
    4141    [Storable]
    4242    [DataMember]
     
    4444    [Storable]
    4545    [DataMember]
    46     public int Memory { get; set; }
     46    public int? Memory { get; set; }
    4747    [Storable]
    4848    [DataMember]
    49     public int FreeMemory { get; set; }
     49    public int? FreeMemory { get; set; }
    5050    [Storable]
    5151    [DataMember]
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Disposable.cs

    r4368 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222
    323namespace HeuristicLab.Hive.Contracts {
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HeuristicLab.Hive.Contracts-3.3.csproj

    r4368 r4423  
    119119    <Compile Include="BusinessObjects\CachedHivePluginInfoDto.cs" />
    120120    <Compile Include="BusinessObjects\CalendarState.cs" />
     121    <Compile Include="BusinessObjects\HiveExperimentDtoList.cs" />
     122    <Compile Include="BusinessObjects\HiveExperimentDto.cs" />
    121123    <Compile Include="BusinessObjects\SerializedJobList.cs" />
    122124    <Compile Include="BusinessObjects\SlaveGroupDto.cs" />
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HiveRoles.cs

    r4302 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222using System.Collections.Generic;
    323using System.Linq;
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Interfaces/IClientFacade.cs

    r4368 r4423  
    4949    [OperationContract]
    5050    ResponseObject<JobResultList> GetChildJobResults(Guid? parentJobId, bool recursive, bool includeParent);
     51
     52    /// <summary>
     53    /// Returns all experiments for the current user
     54    /// </summary>
     55    [OperationContract]
     56    ResponseObject<HiveExperimentDtoList> GetHiveExperiments();
     57   
     58    [OperationContract]
     59    ResponseObject<HiveExperimentDto> UpdateHiveExperiment(HiveExperimentDto hiveExperimentDto);
     60
     61    [OperationContract]
     62    Response DeleteHiveExperiment(Guid hiveExperimentId);
     63
     64    [OperationContract]
     65    ResponseObject<JobDto> AddChildJob(Guid parentJobId, SerializedJob serializedJob);
    5166  }
    5267}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Interfaces/IJobManager.cs

    r4368 r4423  
    9797    [OperationContract]
    9898    ResponseObject<JobDto> PauseJob(SerializedJob serializedJob);
     99
     100    [OperationContract]
     101    ResponseObject<HiveExperimentDtoList> GetHiveExperiments();
     102
     103    [OperationContract]
     104    ResponseObject<HiveExperimentDto> UpdateHiveExperiment(HiveExperimentDto hiveExperimentDto);
     105
     106    [OperationContract]
     107    Response DeleteHiveExperiment(Guid hiveExperimentId);
     108
     109    [OperationContract]
     110    Response DeleteChildJobs(Guid jobId);
    99111  }
    100112}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Interfaces/ILifecycleManager.cs

    r1468 r4423  
    2626using HeuristicLab.DataAccess.Interfaces;
    2727
    28 namespace HeuristicLab.Hive.Contracts.Interfaces {   
     28namespace HeuristicLab.Hive.Contracts.Interfaces {
    2929  /// <summary>
    3030  /// Manages the lifecycle of the application
    3131  /// </summary>
    32   public interface ILifecycleManager {   
     32  public interface ILifecycleManager {
    3333    /// <summary>
    3434    /// Initializes the application
    3535    /// </summary>
    36     void Init();
    37 
    38     /// <summary>
    39     /// The server heartbeat
    40     /// </summary>
    41     void RegisterHeartbeat(EventHandler handler);
    42 
    43     /// <summary>
    44     /// The startup event
    45     /// </summary>
    46     void RegisterStartup(EventHandler handler);
    47 
    48     /// <summary>
    49     /// The shutdown event
    50     /// </summary>
    51     void RegisterShutdown(EventHandler handler);
     36    void Start();
    5237
    5338    /// <summary>
    5439    /// Shuts the application down
    5540    /// </summary>
    56     void Shutdown();
     41    void Stop();
     42
     43    /// <summary>
     44    /// The number of jobs which are transferred at the moment
     45    /// </summary>
     46    int JobsCurrentlyTransferring { get; set; }
     47
     48    event EventHandler ServerHeartbeat;
     49
     50    event EventHandler Started;
     51
     52    event EventHandler Stopped;
    5753  }
    5854}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Interfaces/ISlaveCommunicator.cs

    r4368 r4423  
    5050
    5151    [OperationContract]
    52     ResponseResultReceived StoreFinishedJobResult(Guid clientId, Guid jobId, byte[] result, double percentage, string exception);
     52    ResponseResultReceived StoreFinishedJobResult(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception);
    5353
    5454    [OperationContract]
    55     ResponseResultReceived ProcessSnapshot(Guid clientId, Guid jobId, byte[] result, double percentage, string exception);
     55    ResponseResultReceived ProcessSnapshot(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception);
    5656
    5757    [OperationContract]
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/Interfaces/ISlaveFacade.cs

    r4368 r4423  
    5656    [OperationContract]
    5757    SerializedJob GetLastSerializedResult(Guid jobId);
     58
     59    [OperationContract]
     60    Response DeleteChildJobs(Guid jobId);
    5861  }
    5962}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/MessageContainer.cs

    r4368 r4423  
    4040      FetchOrForceFetchCalendar, AddChildJob,
    4141      PauseJob,
    42       GetChildJobs
     42      GetChildJobs,
     43      DeleteChildJobs
    4344    };
    4445
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/MessageContainerWithCallback.cs

    r4368 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222using HeuristicLab.Common;
    323using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/ResponseStatus.cs

    r4368 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222using System.Collections.Generic;
    323using System.Linq;
     
    525
    626namespace HeuristicLab.Hive.Contracts {
    7   /// <summary>
    8   /// [chn] todo: make names consistent: NotFound, DoesNotExist, NotAvailable, ...
    9   /// </summary>
    1027  public enum ResponseStatus {
    1128    Ok,
     
    1835    GetJobByIdWithDetails_JobDoesNotExist, // ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST
    1936
    20     AddNewJob_JobStateMustBeOffline, // ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE
     37    AddNewJob_InvalidJobState, // ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE
    2138    AddNewJob_JobIdMustNotBeSet, // ApplicationConstants.RESPONSE_JOB_ID_MUST_NOT_BE_SET
    2239    AddNewJob_JobNull, // ApplicationConstants.RESPONSE_JOB_JOB_NULL
     
    3047    AbortJob_JobIsNotBeeingCalculated, // ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED
    3148
    32     GetCalendar_ResourceNotFound, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
     49    GetCalendar_ResourceDoesNotExist, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
    3350    GetCalendar_NoCalendarFound, // ApplicationConstants.RESPONSE_UPTIMECALENDAR_NO_CALENDAR_FOUND
    3451
    35     SetCalendarStatus_ResourceNotFound, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
     52    SetCalendarStatus_ResourceDoesNotExist, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
    3653
    3754    ProcessHeartBeat_UserNotLoggedIn, // ApplicationConstants.RESPONSE_COMMUNICATOR_USER_NOT_LOGGED_IN
     
    6077    DeleteResourceFromGroup_SlaveGroupDoesNotExist, // ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST
    6178
    62     GetAllGroupsOfResource_ResourceNotFound, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
     79    GetAllGroupsOfResource_ResourceDoesNotExist, // ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND
    6380
    6481    DeleteSlaveGroup_SlaveGroupDoesNotExist, // ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST
    6582
     83    GetLastSerializedResult_JobDoesNotExist,
     84    DeleteHiveExperiment_Failed,
     85    DeleteChildJobs_Failed,
    6686  }
    6787}
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/StreamedObject.cs

    r4107 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222using System.Collections.Generic;
    323using System.Linq;
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfServicePool.cs

    r4368 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222using System.ServiceModel;
    323using HeuristicLab.Common;
     24using HeuristicLab.Tracing;
    425
    526namespace HeuristicLab.Hive.Contracts {
    627  public class WcfServicePool<T> {
    728    private static object locker = new object();
     29
    830    private string hostAddress;
     31    public string HostAddress {
     32      get { return hostAddress; }
     33      set {
     34        if (hostAddress != value) {
     35          hostAddress = value;
     36          this.factory = null;
     37        }
     38      }
     39    }
     40
     41    private string endpointName;
     42
    943    private string username;
     44    public string Username {
     45      get { return username; }
     46      set {
     47        if(username != value) {
     48          username = value;
     49          this.factory = null;
     50        }
     51      }
     52    }
     53
    1054    private string password;
    11     private string endpointName;
     55    public string Password {
     56      set {
     57        if (password != value) {
     58          password = value;
     59          this.factory = null;
     60        }
     61      }
     62    }
     63
    1264    private ChannelFactory<T> factory = null;
    1365    private Disposable<T> disposableService = null;
     
    4193        factory.Credentials.UserName.Password = password;
    4294      }
    43 
     95     
    4496      return factory.CreateChannel();
    4597    }
     
    48100      lock (locker) {
    49101        requestCount++;
     102        Logger.Debug("Request for ServiceProxy (count: " + requestCount + ")");
     103        if (disposableService != null) {
     104          if (GetServiceState() == CommunicationState.Faulted) {
     105            DisposeService();
     106          }
     107        }
    50108        if (disposableService == null) {
    51           disposableService = new Disposable<T>(CreateFacade(endpointName));
    52           disposableService.OnDisposing += new EventHandler(disposableService_OnDisposing);
    53         }
     109          disposableService = new Disposable<T>(CreateFacade(this.endpointName));
     110          RegisterServiceEvents();
     111        }       
    54112        return disposableService;
    55113      }
     114    }
     115
     116    private void RegisterServiceEvents() {
     117      disposableService.OnDisposing += new EventHandler(disposableService_OnDisposing);
     118      ((ICommunicationObject)disposableService.Obj).Faulted += new EventHandler(WcfServicePool_Faulted);
     119    }
     120
     121    private void DeregisterServiceEvents() {
     122      disposableService.OnDisposing -= new EventHandler(disposableService_OnDisposing);
     123      ((ICommunicationObject)disposableService.Obj).Faulted -= new EventHandler(WcfServicePool_Faulted);
     124    }
     125
     126    private CommunicationState GetServiceState() {
     127      return ((ICommunicationObject)disposableService.Obj).State;
     128    }
     129
     130    void WcfServicePool_Faulted(object sender, EventArgs e) {
     131      OnExceptionOccured(new CommunicationException(e.ToString()));
    56132    }
    57133
     
    63139      lock (locker) {
    64140        requestCount--;
     141        Logger.Debug("Disposing ServiceProxy (count: " + requestCount + ")");
    65142        if (requestCount == 0) {
    66           WcfSettings.DisposeWcfClient((ICommunicationObject)disposableService.Obj);
    67           disposableService = null;
     143          try {
     144            DeregisterServiceEvents();
     145            WcfSettings.DisposeWcfClient((ICommunicationObject)disposableService.Obj);
     146          }
     147          catch (Exception e) {
     148            OnExceptionOccured(e);
     149          }
     150          finally {
     151            disposableService = null;
     152          }
    68153        } else if (requestCount < 0) {
    69154          throw new WcfServicePoolException("requestCount cannot be less than 0.");
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfServicePoolException.cs

    r4368 r4423  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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
     21using System;
    222
    323namespace HeuristicLab.Hive.Contracts {
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfSettings.cs

    r4368 r4423  
    1 //#define USE_MSG_BINDING
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 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//#define USE_MSG_BINDING
    222using System;
    323using System.Collections.Generic;
Note: See TracChangeset for help on using the changeset viewer.