Exemplo n.º 1
0
		private void RemoveSessionInternal(CimSession session, CimSessionWrapper wrapper)
		{
			DebugHelper.WriteLogEx();
			this.curCimSessionsByInstanceId.Remove(wrapper.InstanceId);
			this.curCimSessionsById.Remove(wrapper.SessionId);
			this.curCimSessionWrapper.Remove(session);
			session.Dispose();
		}
Exemplo n.º 2
0
		private static void RemoveCimSessionFromTemporaryCache(CimSession session, bool dispose)
		{
			if (session != null)
			{
				bool flag = false;
				lock (CimSessionProxy.temporarySessionCacheLock)
				{
					if (CimSessionProxy.temporarySessionCache.ContainsKey(session))
					{
						Dictionary<CimSession, uint> item = CimSessionProxy.temporarySessionCache;
						Dictionary<CimSession, uint> cimSessions = item;
						CimSession cimSession = session;
						CimSession cimSession1 = cimSession;
						item[cimSession] = cimSessions[cimSession1] - 1;
						object[] objArray = new object[1];
						objArray[0] = CimSessionProxy.temporarySessionCache[session];
						DebugHelper.WriteLogEx("Decrease cimsession ref count {0}", 1, objArray);
						if (CimSessionProxy.temporarySessionCache[session] == 0)
						{
							CimSessionProxy.temporarySessionCache.Remove(session);
						}
					}
				}
				if (flag && dispose)
				{
					DebugHelper.WriteLogEx("Dispose cimsession ", 1);
					session.Dispose();
				}
			}
		}