Пример #1
0
        public void OnTerminateProcess(string rawTerminationTime)
        {
            log.DebugFormat("ServerState got the terminateProcess signal.  rawTerminationTime : {0}", rawTerminationTime);

            Task.Run(() =>
            {
                var deserialized = JsonConvert.DeserializeObject <Com.Amazon.Whitewater.Auxproxy.Pbuffer.TerminateProcess>(rawTerminationTime);

                if (deserialized == null)
                {
                    //If termination time isn't sent from AuxProxy use now plus 5 minutes.
                    var defaultTerminationTime = DateTime.UtcNow;
                    defaultTerminationTime     = defaultTerminationTime.AddSeconds(270);
                    terminationTime            = defaultTerminationTime.Ticks;
                }
                else
                {
                    /* TerminationTime coming from AuxProxy is seconds that have elapsed since Unix epoch time begins (00:00:00 UTC Jan 1 1970).
                     * Since epoch time for dotNet starts at 0001-01-01T00:00:00 we need to create a DateTime at the beginning of Unix epoch time
                     * and add the TerminationTime to that date.
                     */
                    var epoch       = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                    terminationTime = epoch.AddSeconds(deserialized.TerminationTime).Ticks;
                }

                processParameters.OnProcessTerminate();
            });
        }
        public void OnTerminateProcess(long terminationTime)
        {
            // TerminationTime coming from AuxProxy is milliseconds that have elapsed since Unix epoch time begins (00:00:00 UTC Jan 1 1970).
            this.terminationTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(terminationTime);

            Log.DebugFormat("ServerState got the terminateProcess signal. termination time : {0}", this.terminationTime);

            Task.Run(() => {
                processParameters.OnProcessTerminate();
            });
        }
Пример #3
0
        public void OnTerminateProcess(long terminationTime)
        {
            Log.DebugFormat("ServerState got the terminateProcess signal. termintation time : {0}", terminationTime);

            Task.Run(() =>
            {
                /* TerminationTime coming from AuxProxy is seconds that have elapsed since Unix epoch time begins (00:00:00 UTC Jan 1 1970).
                 * Since epoch time for dotNet starts at 0001-01-01T00:00:00 we need to create a DateTime at the beginning of Unix epoch time
                 * and add the TerminationTime to that date.
                 */
                var epoch       = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                terminationTime = epoch.AddSeconds(terminationTime).Ticks;

                processParameters.OnProcessTerminate();
            });
        }