Close() public method

Close all resources used by this repository
public Close ( ) : void
return void
Example #1
0
        private void registerRepository(Key location, Repository db)
        {
            db.IncrementOpen();
            WeakReference <Repository> newRef = new WeakReference <Repository>(db);
            WeakReference <Repository> oldRef = cacheMap.put(location, newRef);
            Repository oldDb = oldRef != null?oldRef.get() : null;

            if (oldDb != null)
            {
                oldDb.Close();
            }
        }
Example #2
0
        private void unregisterRepository(Key location)
        {
            WeakReference <Repository> oldRef = cacheMap.GetValue(location);

            cacheMap.Remove(location);
            Repository oldDb = oldRef != null?oldRef.get() : null;

            if (oldDb != null)
            {
                oldDb.Close();
            }
        }
Example #3
0
        private void clearAll()
        {
            for (int stage = 0; stage < 2; stage++)
            {
                var keysToRemove = new List <Key>();

                foreach (KeyValuePair <Key, WeakReference <Repository> > e in cacheMap)
                {
                    Repository db = e.Value.get();
                    if (db != null)
                    {
                        db.Close();
                    }

                    keysToRemove.Add(e.Key);
                }

                foreach (Key key in keysToRemove)
                {
                    cacheMap.Remove(key);
                }
            }
        }
Example #4
0
 public override void closeSelf()
 {
     _repository.Close();
 }