Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1099


Ignore:
Timestamp:
01/08/09 17:17:38 (15 years ago)
Author:
msteinbi
Message:

Implementing Lifecycle Management (#453)

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Contracts/HeuristicLab.Hive.Contracts.csproj

    r1001 r1099  
    8585    <Compile Include="BusinessObjects\User.cs" />
    8686    <Compile Include="BusinessObjects\UserGroup.cs" />
     87    <Compile Include="Interfaces\IClientFacade.cs" />
    8788    <Compile Include="ResponseObject.cs" />
    8889    <Compile Include="Interfaces\IClientManager.cs" />
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r1096 r1099  
    1919  public class ClientCommunicator: IClientCommunicator {
    2020    int nrOfJobs = 0;
    21     Dictionary<Guid, DateTime> lastHeartbeats;
     21    Dictionary<Guid, DateTime> lastHeartbeats =
     22      new Dictionary<Guid,DateTime>();
    2223
    2324    IClientAdapter clientAdapter;
     
    5758          } else {
    5859            DateTime lastHbOfClient = lastHeartbeats[client.ClientId];
    59             int diff = lastHbOfClient.CompareTo(DateTime.Now);
    60             Console.WriteLine(diff);
     60            TimeSpan dif = DateTime.Now.Subtract(lastHbOfClient);
     61            Console.WriteLine(dif);
    6162          }
    6263        } else {
     
    124125    }
    125126
     127    [MethodImpl(MethodImplOptions.Synchronized)]
    126128    public ResponseJob PullJob(Guid clientId) {
    127129      ResponseJob response = new ResponseJob();
     
    144146    }
    145147
     148    [MethodImpl(MethodImplOptions.Synchronized)]
    146149    public ResponseResultReceived SendJobResult(JobResult result, bool finished) {
    147150      ResponseResultReceived response = new ResponseResultReceived();
  • trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj

    r1008 r1099  
    6767  <ItemGroup>
    6868    <Compile Include="ClientCommunicator.cs" />
     69    <Compile Include="ClientFacade.cs" />
    6970    <Compile Include="ClientManager.cs" />
    7071    <Compile Include="DbTestApp.cs" />
  • trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs

    r1086 r1099  
    3030namespace HeuristicLab.Hive.Server.Core {
    3131  public class ServerConsoleFacade: IServerConsoleFacade {
    32     private IClientManager clientManager = new ClientManager();
    33     private IJobManager jobManager = new JobManager();
    34     private IUserRoleManager userRoleManager = new UserRoleManager();
     32    private IClientManager clientManager =
     33      ServiceLocator.GetClientManager();
     34
     35    private IJobManager jobManager =
     36      ServiceLocator.GetJobManager();
     37
     38    private IUserRoleManager userRoleManager =
     39      ServiceLocator.GetUserRoleManager();
    3540
    3641    private String loginName = null;
  • trunk/sources/HeuristicLab.Hive.Server.Core/ServiceLocator.cs

    r1088 r1099  
    2424using System.Runtime.CompilerServices;
    2525using HeuristicLab.Hive.Contracts.Interfaces;
     26using HeuristicLab.Hive.Server.Core;
    2627
    2728/// <summary>
     
    3435  private static ITransactionManager transManager = null;
    3536
     37  private static IClientManager clientManager = null;
     38
     39  private static IJobManager jobManager = null;
     40
     41  private static IUserRoleManager userRoleManager = null;
     42
     43  private static IClientCommunicator clientCommunicator = null;
     44
     45  private static ILifecycleManager lifecycleManager = null;
     46
    3647  private static IClientAdapter clientAdapter = null;
    3748
     
    5061  private static IJobResultsAdapter jobResultsAdapter = null;
    5162
    52   private static ILifecycleManager lifecycleManager = null;
    5363
    5464  /// <summary>
     
    6676
    6777  /// <summary>
     78  /// Gets the client manager
     79  /// </summary>
     80  /// <returns></returns>
     81  [MethodImpl(MethodImplOptions.Synchronized)]
     82  public static IClientManager GetClientManager() {
     83    if (clientManager == null)
     84      clientManager = new ClientManager();
     85
     86    return clientManager;
     87  }
     88
     89  /// <summary>
     90  /// Gets the job manager
     91  /// </summary>
     92  /// <returns></returns>
     93  [MethodImpl(MethodImplOptions.Synchronized)]
     94  public static IJobManager GetJobManager() {
     95    if (jobManager == null)
     96      jobManager = new JobManager();
     97
     98    return jobManager;
     99  }
     100
     101  /// <summary>
     102  /// Gets the user role manager
     103  /// </summary>
     104  /// <returns></returns>
     105  [MethodImpl(MethodImplOptions.Synchronized)]
     106  public static IUserRoleManager GetUserRoleManager() {
     107    if (userRoleManager == null)
     108      userRoleManager = new UserRoleManager();
     109
     110    return userRoleManager;
     111  }
     112
     113  /// <summary>
     114  /// Gets the client Communicator
     115  /// </summary>
     116  /// <returns></returns>
     117  [MethodImpl(MethodImplOptions.Synchronized)]
     118  public static IClientCommunicator GetClientCommunicator() {
     119    if (clientCommunicator == null)
     120      clientCommunicator = new ClientCommunicator();
     121
     122    return clientCommunicator;
     123  }
     124
     125  /// <summary>
     126  /// Gets the lifecycle manager
     127  /// </summary>
     128  /// <returns></returns>
     129  [MethodImpl(MethodImplOptions.Synchronized)]
     130  public static ILifecycleManager GetLifecycleManager() {
     131    if (lifecycleManager == null) {
     132      lifecycleManager = new LifecycleManager();
     133    }
     134
     135    return lifecycleManager;
     136  }
     137
     138  /// <summary>
    68139  /// Gets the client database adapter
    69140  /// </summary>
     
    168239    return jobResultsAdapter;
    169240  }
    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   }
    183241}
  • trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs

    r1084 r1099  
    5757
    5858    private ServiceHost StartClientCommunicator(Uri uriTcp) {
    59       IClientCommunicator[] clientCommunicatorInstances =
    60         discService.GetInstances<IClientCommunicator>();
     59      IClientFacade[] clientCommunicatorInstances =
     60        discService.GetInstances<IClientFacade>();
    6161
    6262      if (clientCommunicatorInstances.Length > 0) {
Note: See TracChangeset for help on using the changeset viewer.