コード例 #1
0
        public byte[] GetBinaryStateSnapshot(OpenMetaverse.UUID itemID, StopScriptReason stopScriptReason)
        {
            if (!_masterScheduler.IsRunning)
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0} master scheduler has died", itemID);
                return(null);
            }

            StateDataRequest req = new StateDataRequest(itemID, true);

            req.DisableScriptReason = stopScriptReason;

            _exeScheduler.RequestStateData(req);
            bool success = req.WaitForData(STATE_REQUEST_TIMEOUT);

            if (req.SerializedStateData != null)
            {
                return(req.SerializedStateData);
            }
            else
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0}, timeout: {1}", itemID,
                                 !success);

                return(null);
            }
        }
コード例 #2
0
        private void SaveStateToDisk(StateDataRequest req)
        {
            //serialize the state
            SerializedRuntimeState serState = (SerializedRuntimeState)req.RawStateData;

            using (MemoryStream ms = new MemoryStream())
            {
                ProtoBuf.Serializer.Serialize(ms, serState);
                WriteBlobRow(req.ItemId, ms);
            }
        }
コード例 #3
0
        private void StateAvailable(StateDataRequest dataRequest)
        {
            lock (_scriptChangeLock)
            {
                _dirtyScripts.Remove(dataRequest.ItemId);

                if (dataRequest.RawStateData != null)
                {
                    _needsSaving[dataRequest.ItemId] = dataRequest;
                }
            }
        }
コード例 #4
0
        public ScriptRuntimeInformation GetScriptInformation(UUID itemId)
        {
            if (!_masterScheduler.IsRunning)
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0} master scheduler has died", itemId);
                return(null);
            }

            StateDataRequest req = new StateDataRequest(itemId, false);

            req.DisableScriptReason = StopScriptReason.None;

            _exeScheduler.RequestStateData(req);
            bool success = req.WaitForData(STATE_REQUEST_TIMEOUT);

            if (!success)
            {
                return(null);
            }

            Serialization.SerializedRuntimeState state = (Serialization.SerializedRuntimeState)req.RawStateData;

            ScriptRuntimeInformation info = new ScriptRuntimeInformation
            {
                CurrentEvent           = state.RunningEvent == null ? "none" : state.RunningEvent.EventType.ToString(),
                CurrentState           = state.RunState.ToString() + " | GlobalEnable: " + state.Enabled + " | " + req.CurrentLocalEnableState.ToString(),
                MemoryUsed             = state.MemInfo.MemoryUsed,
                TotalRuntime           = state.TotalRuntime,
                NextWakeup             = state.NextWakeup,
                StackFrameFunctionName = state.TopFrame == null ? "none" : state.TopFrame.FunctionInfo.Name,
                TimerInterval          = state.TimerInterval,
                TimerLastScheduledOn   = state.TimerLastScheduledOn
            };

            return(info);
        }
コード例 #5
0
        public ScriptRuntimeInformation GetScriptInformation(UUID itemId)
        {
            if (!_masterScheduler.IsRunning)
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0} master scheduler has died", itemId);
                return null;
            }

            StateDataRequest req = new StateDataRequest(itemId, false);
            req.DisableScriptReason = StopScriptReason.None;

            _exeScheduler.RequestStateData(req);
            bool success = req.WaitForData(STATE_REQUEST_TIMEOUT);

            if (!success) return null;

            Serialization.SerializedRuntimeState state = (Serialization.SerializedRuntimeState)req.RawStateData;

            ScriptRuntimeInformation info = new ScriptRuntimeInformation
            {
                CurrentEvent = state.RunningEvent == null ? "none" : state.RunningEvent.EventType.ToString(),
                CurrentState = state.RunState.ToString() + " | GlobalEnable: " + state.Enabled + " | " + req.CurrentLocalEnableState.ToString(),
                MemoryUsed = state.MemInfo.MemoryUsed,
                TotalRuntime = state.TotalRuntime,
                NextWakeup = state.NextWakeup,
                StackFrameFunctionName = state.TopFrame == null ? "none" : state.TopFrame.FunctionInfo.Name,
                TimerInterval = state.TimerInterval,
                TimerLastScheduledOn = state.TimerLastScheduledOn
            };

            return info;
        }
コード例 #6
0
        public byte[] GetBinaryStateSnapshot(OpenMetaverse.UUID itemID, StopScriptReason stopScriptReason)
        {
            if (!_masterScheduler.IsRunning)
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0} master scheduler has died", itemID);
                return null;
            }

            StateDataRequest req = new StateDataRequest(itemID, true);
            req.DisableScriptReason = stopScriptReason;

            _exeScheduler.RequestStateData(req);
            bool success = req.WaitForData(STATE_REQUEST_TIMEOUT);

            if (req.SerializedStateData != null)
            {
                return req.SerializedStateData;
            }
            else
            {
                _log.ErrorFormat("[Phlox]: Unable to retrieve state data for {0}, timeout: {1}", itemID,
                    !success);

                return null;
            }
        }
コード例 #7
0
ファイル: StateManager.cs プロジェクト: kf6kjg/halcyon
        private void SaveStateToDisk(StateDataRequest req)
        {
            //serialize the state
            SerializedRuntimeState serState = (SerializedRuntimeState)req.RawStateData;

            using (MemoryStream ms = new MemoryStream())
            {
                ProtoBuf.Serializer.Serialize(ms, serState);
                WriteBlobRow(req.ItemId, ms);
            }
        }
コード例 #8
0
ファイル: StateManager.cs プロジェクト: kf6kjg/halcyon
        private void StateAvailable(StateDataRequest dataRequest)
        {
            lock (_scriptChangeLock)
            {
                _dirtyScripts.Remove(dataRequest.ItemId);

                if (dataRequest.RawStateData != null)
                {
                    _needsSaving[dataRequest.ItemId] = dataRequest;
                }
            }
        }