public MessageManager( ILogManager logManager, IMainLoopManager mainLoopManager ) { if ( logManager == null ) { throw new ArgumentNullException( "logManager", "The log manager must not be null." ); } if ( mainLoopManager == null ) { throw new ArgumentNullException( "mainLoopManager", "The main loop manager must not be null." ); } this.LogManager = logManager; mainLoopManager.HeartbeatEnded += new HeartbeatDelegate( this.MainLoopManager_HeartbeatEnded ); }
public SystemsManager( IPluginManager pluginManager, ILogManager logManager, INGinCore core, IMainLoopManager mainLoopManager ) { this.LogManager = logManager; foreach ( SystemAttribute plugin in pluginManager.GetPluginsForType( typeof( SystemAttribute ) ) ) { // create and store system //ConstructorInfo constructor = plugin.SystemType.GetConstructor( plugin.ConstructorParameterTypes ); //ISystem system = plugin.SystemType.InvokeMember( plugin.SystemType.Name, global::System.Reflection.BindingFlags.CreateInstance, null, null, new object[] { this.LogManager } ) as ISystem; ISystem system = core.GetService( plugin.SystemType ) as ISystem; lock ( this.registeredSystemsLock ) { this.registeredSystems.Add( system.Name, system ); } } }
public TaskManager( ILogManager logManager, ISystemsManager systemsManager, IMainLoopManager mainLoopManager, IStateManager stateManager ) { if ( logManager == null ) { string message = "The log manager must not be null."; ArgumentNullException argEx = new ArgumentNullException( "logManager", message ); throw argEx; } this.LogManager = logManager; if ( systemsManager == null ) { string message = "The systems manager must not be null."; ArgumentNullException argEx = new ArgumentNullException( "systemsManager", message ); LogManager.Trace( Namespace.LoggerName, LogLevel.Error, argEx, message ); throw argEx; } if ( mainLoopManager == null ) { string message = "The main loop manager must not be null."; ArgumentNullException argEx = new ArgumentNullException( "mainLoopManager", message ); LogManager.Trace( Namespace.LoggerName, LogLevel.Error, argEx, message ); throw argEx; } if ( stateManager == null ) { string message = "The state manager must not be null."; ArgumentNullException argEx = new ArgumentNullException( "stateManager", message ); LogManager.Trace( Namespace.LoggerName, LogLevel.Error, argEx, message ); throw argEx; } this.SystemsManager = systemsManager; this.MainLoopManager = mainLoopManager; this.StateManager = stateManager; this.MainLoopManager.HeartbeatStarted += new HeartbeatDelegate( this.MainLoopManager_HeartbeatStarted ); // set min and max to processor count int defaultThreadCount = Environment.ProcessorCount; ThreadPool.SetMaxThreads( defaultThreadCount, defaultThreadCount ); ThreadPool.SetMinThreads( defaultThreadCount, defaultThreadCount ); int minWorker, minComp, maxWorker, maxComp; ThreadPool.GetMinThreads( out minWorker, out minComp ); ThreadPool.GetMaxThreads( out maxWorker, out maxComp ); this.LogManager.Trace( Namespace.LoggerName, LogLevel.Debugging, "ThreadPool WorkerThreads - MIN: {0}, MAX: {1}", minWorker, maxWorker ); }