Ejemplo n.º 1
0
        protected override void OnShutdown()
        {
            if (IsInitialized)
            {
                var wait = new AutoResetEvent(false);
                IOTaskPool.ExecuteInContext(() =>
                {
                    World.Instance.Stop(true);
                    World.Instance.Save();
                    wait.Set();
                });

                wait.WaitOne(-1);
            }

            IPCAccessor.Instance.Stop();

            if (IOTaskPool != null)
            {
                IOTaskPool.Stop();
            }

            ClientManager.Pause();

            foreach (var client in ClientManager.Clients.ToArray())
            {
                client.Disconnect();
            }

            ClientManager.Close();
        }
Ejemplo n.º 2
0
        public virtual void CancelScheduledShutdown()
        {
            IsShutdownScheduled   = false;
            ScheduledShutdownDate = DateTime.MaxValue;

            IOTaskPool.RemoveTimer(ScheduledShutdownTimer);
            ScheduledShutdownTimer = null;
        }
Ejemplo n.º 3
0
        public virtual void ScheduleShutdown(TimeSpan timeBeforeShuttingDown)
        {
            IsShutdownScheduled   = true;
            ScheduledShutdownDate = DateTime.Now + timeBeforeShuttingDown;

            if (ScheduledShutdownTimer != null)
            {
                IOTaskPool.RemoveTimer(ScheduledShutdownTimer);
            }

            ScheduledShutdownTimer = IOTaskPool.CallPeriodically((int)TimeSpan.FromSeconds(1).TotalMilliseconds, CheckScheduledShutdown);
        }
Ejemplo n.º 4
0
        public virtual void Start()
        {
            Running      = true;
            Initializing = false;

            IOTaskPool.CallPeriodically((int)TimeSpan.FromSeconds(10).TotalMilliseconds, KeepSQLConnectionAlive);

            var evnt = ServerStarted;

            if (evnt != null)
            {
                evnt();
            }
        }
Ejemplo n.º 5
0
        public override void Start()
        {
            base.Start();

            logger.Info("Start Ipc Server");
            IpcHost.Start();

            logger.Info("Starting Console Handler Interface...");
            ConsoleInterface.Start();

            logger.Info("Start listening on port : " + Port + "...");
            m_host = HostAutoDefined ? IPAddress.Loopback.ToString() : Host;

            ClientManager.Start(m_host, Port);

            IOTaskPool.Start();

            StartTime = DateTime.Now;
        }
Ejemplo n.º 6
0
        public override void Start()
        {
            base.Start();

            logger.Info("Start Auto-Save Cyclic Task");
            IOTaskPool.CallPeriodically(AutoSaveInterval * 1000, World.Instance.Save);

            logger.Info("Starting Console Handler Interface...");
            ConsoleInterface.Start();

            logger.Info("Starting IPC Communications ...");
            IPCAccessor.Instance.Start();

            logger.Info("Start listening on port : " + Port + "...");
            ClientManager.Start(Host, Port);

            IOTaskPool.Start();
            StartTime = DateTime.Now;
        }
Ejemplo n.º 7
0
 protected virtual void OnShutdown()
 {
     IOTaskPool.Stop();
 }