상속: BaseDataStructure
예제 #1
0
파일: Session.cs 프로젝트: Redi0/meijing-ui
        public Session(Connection connection, SessionId sessionId, AcknowledgementMode acknowledgementMode)
        {
            this.info = new SessionInfo();
            this.info.SessionId = sessionId;
            this.connection = connection;
            this.connection.Oneway(this.info);

            this.acknowledgementMode = acknowledgementMode;
            this.requestTimeout = connection.RequestTimeout;
            this.dispatchAsync = connection.DispatchAsync;
            this.transactionContext = new TransactionContext(this);

            Uri brokerUri = connection.BrokerUri;

            // Set propertieDs on session using parameters prefixed with "session."
            if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
            {
                string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);
                StringDictionary options = URISupport.ParseQuery(query);
                options = URISupport.GetProperties(options, "session.");
                URISupport.SetProperties(this, options);
            }

            this.ConsumerTransformer = connection.ConsumerTransformer;
            this.ProducerTransformer = connection.ProducerTransformer;

            this.executor = new SessionExecutor(this, this.consumers);

            if(connection.IsStarted)
            {
                this.Start();
            }

            connection.AddSession(this);
        }
예제 #2
0
 public ProducerId( SessionId sessionId, long consumerId )
 {
     this.connectionId = sessionId.ConnectionId;
     this.sessionId = sessionId.Value;
     this.value = consumerId;
 }
예제 #3
0
 public NetTxSession(Connection connection, SessionId id)
     : base(connection, id, AcknowledgementMode.AutoAcknowledge)
 {
     TransactionContext.InitializeDtcTxContext();
 }
예제 #4
0
 public override Response processRemoveSession(SessionId id)
 {
     if(id != null)
     {
         ConnectionId connectionId = id.ParentId;
         if(connectionId != null)
         {
             ConnectionState cs = connectionStates[connectionId];
             if(cs != null)
             {
                 cs.removeSession(id);
             }
         }
     }
     return TRACKED_RESPONSE_MARKER;
 }
예제 #5
0
 public virtual Response processRemoveSession(SessionId id)
 {
     return null;
 }
예제 #6
0
        public override Response processRemoveSession(SessionId id)
        {
            if(id != null)
            {
                ConnectionId connectionId = id.ParentId;
                if(connectionId != null)
                {
					ConnectionState cs = null;

					if(connectionStates.TryGetValue(connectionId, out cs))
                    {
                        cs.removeSession(id);
                    }
                }
            }
            return TRACKED_RESPONSE_MARKER;
        }
예제 #7
0
 public SessionInfo(ConnectionInfo connectionInfo, long sessionId)
 {
     this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);
 }
예제 #8
0
 public SessionState removeSession(SessionId id)
 {
     SessionState ret = sessions[id];
     sessions.Remove(id);
     return ret;
 }
예제 #9
0
 public SessionState this[SessionId id]
 {
     get
     {
         #if DEBUG
         try
         {
         #endif
             return sessions[id];
         #if DEBUG
         }
         catch(System.Collections.Generic.KeyNotFoundException)
         {
             // Useful for dignosing missing session ids
             string sessionList = string.Empty;
             foreach(SessionId sessionId in sessions.Keys)
             {
                 sessionList += sessionId.ToString() + "\n";
             }
             System.Diagnostics.Debug.Assert(false,
                 string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
             throw;
         }
         #endif
     }
 }
예제 #10
0
		public SessionState removeSession(SessionId id)
		{
			SessionState ret = null;

			sessions.TryGetValue(id, out ret);
			sessions.Remove(id);
			return ret;
		}
예제 #11
0
		public SessionState this[SessionId id]
		{
			get
			{
				SessionState sessionState;

				if(sessions.TryGetValue(id, out sessionState))
				{
					return sessionState;
				}

#if DEBUG
				// Useful for dignosing missing session ids
				string sessionList = string.Empty;
				foreach(SessionId sessionId in sessions.Keys)
				{
					sessionList += sessionId.ToString() + "\n";
				}

				System.Diagnostics.Debug.Assert(false,
					string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
#endif
				return null;
			}
		}
예제 #12
0
 public SessionInfo(ConnectionInfo connectionInfo, long sessionId)
 {
     this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);
 }