public void Close()
        {
            if (sessionElapsedTimer == null) return;

            UnRegister();
            sessionElapsedTimer.Close();
            sessionElapsedTimer = null;

            sessionStateEngine.Close();
            sessionStateEngine = null;
        }
 public SessionContext(string sessionId, IRequestHandler requestHandler, IRegistrator<string, ISessionContext> publisherRegistrator)
 {
     this.publisherRegistrator = publisherRegistrator;
     SessionId = sessionId;
     RequestHandler = requestHandler;
     sessionStateEngine = SessionStateEngineFactory.Create(this);
     SessionTimeoutContext = new ElapsedTimerContext(SessionTimerConstants.SESSION_TIME_OUT);
     ResponseTimeoutContext = new ElapsedTimerContext(SessionTimerConstants.RESPONSE_TIME_OUT);
     sessionElapsedTimer = new SessionElaspedTimer(sessionStateEngine, this);
     UnRegister();
 }
示例#3
0
 public void Process(Event eventObj, StateEngine engineObj)
 {
     IStateRule ruleObj;
     if (!stateRules.TryGetValue(eventObj.Name, out ruleObj)) throw new UnKnownStateEventException();
     engineObj.SetState(ruleObj.Action(eventObj.Message, name));
 }
 public SessionElaspedTimer(StateEngine agentStateEngine, SessionContext sessionContext)
 {
     this.agentStateEngine = agentStateEngine;
     this.sessionContext = sessionContext;
     elaspedTimer = new ElaspedTimer(SessionTimerConstants.TIMER_ELASPED_TIME, OnTimeElaspedHandler);
 }