/// <summary> /// constructor /// </summary> public TPollClientTasks(TClientTasksManager AClientTasksManager) { FLastPollingTime = DateTime.Now; FClientTasksManager = AClientTasksManager; TLogging.LogAtLevel(10, "TPollClientTasks created"); }
/// <summary> /// constructors /// </summary> /// <param name="AClientTasksManager"></param> public TPollClientTasksParameters(TClientTasksManager AClientTasksManager) { if (TLogging.DL >= 10) { Console.WriteLine("{0} TPollClientTasksParameters created", DateTime.Now); } TPollClientTasks.UClientTasksManager = AClientTasksManager; TPollClientTasks.ULastPollingTime = DateTime.Now; }
/// start the session public void StartSession() { FTasksManager = new TClientTasksManager(); FPollClientTasks = new TPollClientTasks(FTasksManager); FClientConnectionStartTime = DateTime.Now; SessionStatus = TSessionStatus.adsActive; FClientConnectionFinishedTime = DateTime.Now; }
/// <summary> /// constructor /// </summary> public TPollClientTasks(TClientTasksManager AClientTasksManager) { FLastPollingTime = DateTime.Now; FClientTasksManager = AClientTasksManager; if (TLogging.DL >= 10) { TLogging.Log("TPollClientTasks created"); } }
/// start the session public void StartSession(TDelegateTearDownAppDomain ATearDownAppDomain) { FTasksManager = new TClientTasksManager(); FPollClientTasks = new TPollClientTasks(FTasksManager); FClientConnectionStartTime = DateTime.Now; // Start ClientStillAliveCheck Thread new ClientStillAliveCheck.TClientStillAliveCheck(this, FClientServerConnectionType, ATearDownAppDomain); SessionStatus = TSessionStatus.adsActive; FClientConnectionFinishedTime = DateTime.Now; }
/// <summary> /// Sets up .NET Remoting Lifetime Services and TCP Channel for this AppDomain. /// /// @comment WARNING: If you need to change the parameters of the Constructor, /// you also need to change the parameters in the .NET Reflection call in /// TClientAppDomainConnection! /// /// </summary> /// <param name="AClientID">ClientID as assigned by the ClientManager</param> /// <param name="AClientServerConnectionType">Tells in which way the Client connected /// to the PetraServer</param> /// <param name="AClientManagerRef">A reference to the ClientManager object /// (Note: .NET Remoting will be working behind the scenes since calls to /// this Object will cross AppDomains!)</param> /// <param name="AUserID"></param> /// <returns>void</returns> public TClientDomainManagerBase(String AClientID, TClientServerConnectionType AClientServerConnectionType, TClientManagerCallForwarder AClientManagerRef, string AUserID) { new TAppSettingsManager(false); FUserID = AUserID; // Console.WriteLine('TClientDomainManager.Create in AppDomain: ' + Thread.GetDomain().FriendlyName); DomainManagerBase.GClientID = Convert.ToInt16(AClientID); DomainManagerBase.UClientManagerCallForwarderRef = AClientManagerRef; FClientServerConnectionType = AClientServerConnectionType; FClientTasksManager = new TClientTasksManager(); FTearDownAppDomainMonitor = new System.Object(); Random random = new Random(); FRandomAppDomainTearDownToken = random.Next(Int32.MinValue, Int32.MaxValue).ToString(); // // Set up .NET Remoting Lifetime Services and TCP Channel for this AppDomain. // Note: .NET Remoting needs to be set up separately for each AppDomain, and settings in // the .NET (Remoting) Configuration File are valid only for the Default AppDomain. // try { // The following settings equal to a config file's // <lifetime leaseTime="10MS" renewOnCallTime="10MS" leaseManagerPollTime = "5MS" /> // setting. // Please note that this breaks remoting on mono, but these settings help on MS .NET // to find any remoted objects whose lifetime was inadvertedly not configured, and // therefore live only very short and calls to them break... // LifetimeServices.LeaseTime := TimeSpan.FromMilliseconds(10); // LifetimeServices.RenewOnCallTime := TimeSpan.FromMilliseconds(10); // LifetimeServices.LeaseManagerPollTime := TimeSpan.FromMilliseconds(5); // More sensible settings for Lifetime Services // TODO 1 ochristiank cRemoting : .NET Remoting LifetimeSettings should be flexible instead hardcoded in the future! try { LifetimeServices.LeaseTime = TimeSpan.FromSeconds(60); LifetimeServices.RenewOnCallTime = TimeSpan.FromSeconds(60); LifetimeServices.LeaseManagerPollTime = TimeSpan.FromSeconds(5); } catch (RemotingException) { // ignore System.Runtime.Remoting.RemotingException : 'LeaseTime' can only be set once within an AppDomain. // this happens in the Server NUnit test, when running several tests, therefore reconnecting with the same AppDomain. } } catch (Exception e) { TLogging.Log(e.ToString()); throw; } if (TLogging.DL >= 4) { Console.WriteLine("Application domain: " + Thread.GetDomain().FriendlyName); Console.WriteLine(" for User: " + FUserID); } }