Пример #1
0
 public void RemoveSession(RemoteServerSession session)
 {
     lock (this)
     {
         CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName];
         if (cache != null)
         {
             cache.Sessions.Remove(session);
         }
     }
 }
Пример #2
0
        public void AddSession(RemoteServerSession session)
        {
            lock (this)
            {
                CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName];
                if (cache == null)
                {
                    cache = new CatalogCache(session.CatalogCacheName, session.Server.CacheTimeStamp, _defaultCachedObjects);
                    _caches.Add(cache.CacheName, cache);
                }

                cache.Sessions.Add(session);
            }
        }
 // IRemoteServer.Disconnect
 public void Disconnect(IRemoteServerSession session)
 {
     BeginCall();
     try
     {
         RemoteServerSession localSession = session as RemoteServerSession;
         if (session != null)
         {
             localSession.Dispose();
         }
     }
     finally
     {
         EndCall();
     }
 }
Пример #4
0
        public void RemovePlanDescriptor(RemoteServerSession session, string catalogObjectName)
        {
            CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName];

            if (cache != null)
            {
                lock (cache)
                {
                    int index = cache.CachedObjects.IndexOfName(catalogObjectName);
                    if (index >= 0)
                    {
                        cache.CachedObjects.RemoveAt(index);
                    }
                }
            }
        }
 // IRemoteServer.Connect
 public IRemoteServerSession Connect(SessionInfo sessionInfo)
 {
     BeginCall();
     try
     {
         RemoteServerSession session = new RemoteServerSession(_server, (ServerSession)_server.Server.Connect(sessionInfo));
         if (sessionInfo.CatalogCacheName != String.Empty)
         {
             _server.CatalogCaches.AddSession(session);
         }
         _sessions.Add(session);
         return(session);
     }
     finally
     {
         EndCall();
     }
 }
 internal void CloseSessions()
 {
     if (_sessions != null)
     {
         while (_sessions.Count > 0)
         {
             RemoteServerSession session = (RemoteServerSession)_sessions.DisownAt(0);
             try
             {
                 session.Dispose();
             }
             catch (Exception E)
             {
                 _server.Server.LogError(E);
             }
         }
     }
 }
Пример #7
0
        public string[] GetRequiredObjects(RemoteServerSession session, Schema.Catalog catalog, long cacheTimeStamp, out long clientCacheTimeStamp)
        {
            List <string> requiredObjects = new List <string>();
            CatalogCache  cache           = (CatalogCache)_caches[session.CatalogCacheName];

            lock (cache)
            {
                bool cacheChanged = cache.EnsureConsistent(cacheTimeStamp, _defaultCachedObjects);
                foreach (Schema.Object objectValue in catalog)
                {
                    if (!cache.CachedObjects.ContainsName(objectValue.Name))
                    {
                        if (!((objectValue is Schema.DerivedTableVar) && (objectValue.Name == ((Schema.DerivedTableVar)objectValue).SessionObjectName)))
                        {
                            cache.CachedObjects.Add(objectValue);
                        }
                        requiredObjects.Add(objectValue.Name);
                    }
                }

                if (!cacheChanged)
                {
                    cache.UpdateTimeStamp();
                }

                clientCacheTimeStamp = cache.TimeStamp;
            }

            string[] result = new string[requiredObjects.Count];
            requiredObjects.CopyTo(result, 0);

                        #if LOGCACHEEVENTS
            ASession.Server.LogMessage(String.Format("Session {0} cache timestamp updated to {1} with required objects: {2}", ASession.SessionID.ToString(), AClientCacheTimeStamp.ToString(), ExceptionUtility.StringsToCommaList(requiredObjects)));
                        #endif

            return(result);
        }
Пример #8
0
 internal RemoteServerProcess(RemoteServerSession session, ServerProcess process) : base()
 {
     _session       = session;
     _serverProcess = process;
     AttachServerProcess();
 }