Changeset 1088
- Timestamp:
- 01/07/09 17:04:39 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/Interfaces/ILifecycleManager.cs
r948 r1088 25 25 using System.Text; 26 26 27 namespace HeuristicLab.Hive.Contracts.Interfaces { 27 namespace HeuristicLab.Hive.Contracts.Interfaces { 28 28 /// <summary> 29 29 /// Manages the lifecycle of the application 30 30 /// </summary> 31 public interface ILifecycleManager { 31 public interface ILifecycleManager { 32 32 /// <summary> 33 33 /// Initializes the application 34 34 /// </summary> 35 35 void Init(); 36 37 /// <summary> 38 /// The server heartbeat 39 /// </summary> 40 event EventHandler OnServerHeartbeat; 36 41 37 42 /// <summary> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs
r1029 r1088 52 52 } 53 53 54 [MethodImpl(MethodImplOptions.Synchronized)] 54 55 protected virtual RowT FindSingleRow(Selector dbSelector, 55 56 Selector cacheSelector) { … … 66 67 } 67 68 69 [MethodImpl(MethodImplOptions.Synchronized)] 68 70 protected virtual IEnumerable<RowT> FindMultipleRows(Selector dbSelector, 69 71 Selector cacheSelector) { … … 83 85 } 84 86 87 [MethodImpl(MethodImplOptions.Synchronized)] 85 88 protected virtual ObjT FindSingle(Selector dbSelector, 86 89 Selector cacheSelector) { … … 97 100 } 98 101 102 [MethodImpl(MethodImplOptions.Synchronized)] 99 103 protected virtual ICollection<ObjT> FindMultiple(Selector dbSelector, 100 104 Selector cacheSelector) { … … 142 146 } 143 147 148 [MethodImpl(MethodImplOptions.Synchronized)] 144 149 protected override RowT GetRowById(long id) { 145 150 RowT row = -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs
r1025 r1088 51 51 protected delegate IEnumerable<RowT> Selector(); 52 52 53 [MethodImpl(MethodImplOptions.Synchronized)] 53 54 protected virtual RowT FindSingleRow(Selector selector) { 54 55 RowT row = default(RowT); … … 63 64 } 64 65 66 [MethodImpl(MethodImplOptions.Synchronized)] 65 67 protected virtual ObjT FindSingle(Selector selector) { 66 68 RowT row = FindSingleRow(selector); … … 76 78 } 77 79 80 [MethodImpl(MethodImplOptions.Synchronized)] 78 81 protected virtual ICollection<ObjT> FindMultiple(Selector selector) { 79 82 IEnumerable<RowT> found = … … 92 95 } 93 96 97 [MethodImpl(MethodImplOptions.Synchronized)] 94 98 protected virtual RowT GetRowById(long id) { 95 99 return FindSingleRow( … … 117 121 } 118 122 123 [MethodImpl(MethodImplOptions.Synchronized)] 119 124 public virtual ObjT GetById(long id) { 120 125 return FindSingle(delegate() { … … 123 128 } 124 129 130 [MethodImpl(MethodImplOptions.Synchronized)] 125 131 public virtual ICollection<ObjT> GetAll() { 126 132 return new List<ObjT>( -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/HeuristicLab.Hive.Server.ADODataAccess.csproj
r1000 r1088 94 94 </ItemGroup> 95 95 <ItemGroup> 96 <None Include="app.config" /> 96 97 <None Include="dsHiveServer.xsc"> 97 98 <DependentUpon>dsHiveServer.xsd</DependentUpon> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/Properties/Settings.Designer.cs
r826 r1088 27 27 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 28 [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] 29 [global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.22.20.84;Initial Catalog=HiveServer; Persist Security Info=True;Use" +30 " r ID=hive;Password=hive")]29 [global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.22.20.84;Initial Catalog=HiveServer;MultipleActiveResultSets=True;" + 30 "Persist Security Info=True;User ID=hive;Password=hive")] 31 31 public string HiveServerConnectionString { 32 32 get { -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/Properties/Settings.settings
r826 r1088 6 6 <DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?> 7 7 <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 8 <ConnectionString>Data Source=10.22.20.84;Initial Catalog=HiveServer; Persist Security Info=True;User ID=hive;Password=hive</ConnectionString>8 <ConnectionString>Data Source=10.22.20.84;Initial Catalog=HiveServer;MultipleActiveResultSets=True;Persist Security Info=True;User ID=hive;Password=hive</ConnectionString> 9 9 <ProviderName>System.Data.SqlClient</ProviderName> 10 10 </SerializableConnectionString></DesignTimeValue> 11 <Value Profile="(Default)">Data Source=10.22.20.84;Initial Catalog=HiveServer; Persist Security Info=True;User ID=hive;Password=hive</Value>11 <Value Profile="(Default)">Data Source=10.22.20.84;Initial Catalog=HiveServer;MultipleActiveResultSets=True;Persist Security Info=True;User ID=hive;Password=hive</Value> 12 12 </Setting> 13 13 </Settings> -
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1022 r1088 18 18 public class ClientCommunicator: IClientCommunicator { 19 19 int nrOfJobs = 0; 20 Dictionary<Guid, DateTime> lastHeartbeats; 20 21 21 22 IClientAdapter clientAdapter; 22 23 IJobAdapter jobAdapter; 23 24 IJobResultsAdapter jobResultAdapter; 25 ILifecycleManager lifecycleManager; 24 26 25 27 public ClientCommunicator() { … … 27 29 jobAdapter = ServiceLocator.GetJobAdapter(); 28 30 jobResultAdapter = ServiceLocator.GetJobResultsAdapter(); 31 lifecycleManager = ServiceLocator.GetLifecycleManager(); 32 33 lifecycleManager.OnServerHeartbeat += 34 new EventHandler(lifecycleManager_OnServerHeartbeat); 29 35 30 36 for (int i = 0; i < nrOfJobs; i++) { … … 34 40 jobAdapter.Update(job); 35 41 } 42 lastHeartbeats = new Dictionary<Guid, DateTime>(); 36 43 44 } 45 46 void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) { 47 List<ClientInfo> allClients = new List<ClientInfo>(clientAdapter.GetAll()); 48 49 foreach (ClientInfo client in allClients) { 50 51 } 37 52 } 38 53 … … 58 73 public ResponseHB SendHeartBeat(HeartBeatData hbData) { 59 74 ResponseHB response = new ResponseHB(); 75 76 if (lastHeartbeats.ContainsKey(hbData.ClientId)) { 77 lastHeartbeats[hbData.ClientId] = DateTime.Now; 78 } else { 79 lastHeartbeats.Add(hbData.ClientId, DateTime.Now); 80 } 60 81 61 82 response.Success = true; -
trunk/sources/HeuristicLab.Hive.Server.Core/LifecycleManager.cs
r948 r1088 26 26 using HeuristicLab.Hive.Contracts.Interfaces; 27 27 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 28 using System.Timers; 28 29 29 30 namespace HeuristicLab.Hive.Server.Core { 30 31 class LifecycleManager: ILifecycleManager { 32 private static Timer timer = 33 new Timer(); 34 31 35 #region ILifecycleManager Members 36 public event EventHandler OnServerHeartbeat; 37 38 public LifecycleManager() { 39 timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); 40 } 32 41 33 42 public void Init() { 34 //nothing to do 43 timer.Interval = new TimeSpan(0, 0, 10).TotalMilliseconds; // TODO: global constant needed 44 timer.Start(); 45 } 46 47 void timer_Elapsed(object sender, ElapsedEventArgs e) { 48 if (OnServerHeartbeat != null) 49 OnServerHeartbeat(this, null); 35 50 } 36 51 -
trunk/sources/HeuristicLab.Hive.Server.Core/ServiceLocator.cs
r1005 r1088 49 49 50 50 private static IJobResultsAdapter jobResultsAdapter = null; 51 52 private static ILifecycleManager lifecycleManager = null; 51 53 52 54 /// <summary> … … 166 168 return jobResultsAdapter; 167 169 } 170 171 /// <summary> 172 /// Gets the lifecycle manager 173 /// </summary> 174 /// <returns></returns> 175 [MethodImpl(MethodImplOptions.Synchronized)] 176 public static ILifecycleManager GetLifecycleManager() { 177 if (lifecycleManager == null) { 178 lifecycleManager = discoveryService.GetInstances<ILifecycleManager>()[0]; 179 } 180 181 return lifecycleManager; 182 } 168 183 }
Note: See TracChangeset
for help on using the changeset viewer.