Clear() 공개 메소드

public Clear ( ) : void
리턴 void
예제 #1
0
        public void Write(Action <Stream> readWriteAction)
        {
            lock (this)
            {
                if (disposed)
                {
                    throw new ObjectDisposedException("Cannot access persistent source after it was disposed");
                }

                bool success = false;
                try
                {
                    CurrentStates = new List <PersistentDictionaryState>(
                        globalStates.Select(x => new PersistentDictionaryState(x.Comparer)
                    {
                        KeyToFilePositionInFiles = x.KeyToFilePositionInFiles,
                        SecondaryIndicesState    = x.SecondaryIndicesState.ToList()
                    }));

                    readWriteAction(Log);
                    success = true;
                }
                finally
                {
                    if (success)
                    {
                        pool.Clear();
                        globalStates = CurrentStates;
                    }
                    CurrentStates = null;
                }
            }
        }
예제 #2
0
        public void Write(Action <Stream> readWriteAction)
        {
            lock (this)
            {
                if (disposed)
                {
                    throw new ObjectDisposedException("Cannot access persistent source after it was disposed");
                }

                try
                {
                    CurrentStates = new List <PersistentDictionaryState>(
                        globalStates.Select(x => new PersistentDictionaryState(x.Comparer)
                    {
                        KeyToFilePositionInFiles = x.KeyToFilePositionInFiles,
                        SecondaryIndicesState    = x.SecondaryIndicesState
                    }));

                    readWriteAction(Log);
                }
                finally
                {
                    pool.Clear();
                    Interlocked.Exchange(ref globalStates, CurrentStates);
                    CurrentStates = null;
                }
            }
        }
예제 #3
0
        public void Write(Action <Stream> readWriteAction)
        {
            lock (this)
            {
                try
                {
                    currentStates.Value = new List <PersistentDictionaryState>(
                        globalStates.Select(x => new PersistentDictionaryState(x.Comparer)
                    {
                        KeyToFilePositionInFiles = x.KeyToFilePositionInFiles,
                        SecondaryIndicesState    = x.SecondaryIndicesState
                    }));

                    readWriteAction(Log);
                }
                finally
                {
                    pool.Clear();
                    Interlocked.Exchange(ref globalStates, currentStates.Value);
                    currentStates.Value = null;
                }
            }
        }