Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/21/12 13:42:34 (12 years ago)
Author:
ascheibe
Message:

#1648 fetch user and client information when the optimizer starts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Access/3.3/UserInformation.cs

    r8043 r8076  
    2222using System;
    2323using System.ServiceModel.Security;
     24using System.Threading.Tasks;
    2425
    2526namespace HeuristicLab.Clients.Access {
     
    3031    public static UserInformation Instance {
    3132      get {
    32         if (instance == null) instance = new UserInformation();
     33        InitializeUserInformation();
    3334        return instance;
    3435      }
     
    6162
    6263    private UserInformation() {
    63       //this blocks, so there should be anywhere in the Optimizer startup process
    64       //a call to FetchUserInformationFromServerAsync which is non-blocking
    65       FetchUserInformationFromServer();
     64      if (instance == null) {
     65        FetchUserInformationFromServer();
     66      }
    6667    }
    67 
    6868
    6969    private void FetchUserInformationFromServer() {
     
    9292      FetchUserInformationFromServer();
    9393    }
     94
     95    private static void InitializeUserInformation() {
     96      if (instance == null) instance = new UserInformation();
     97    }
     98
     99    public static void InitializeAsync() {
     100      Task.Factory.StartNew(InitializeUserInformation);
     101    }
    94102  }
    95103}
Note: See TracChangeset for help on using the changeset viewer.