Beispiel #1
0
 internal void DoAfterFlush(DocumentsWriterPerThread dwpt)
 {
     lock (this)
     {
         Debug.Assert(flushingWriters.ContainsKey(dwpt));
         try
         {
             long?bytes = flushingWriters[dwpt];
             flushingWriters.Remove(dwpt);
             flushBytes -= (long)bytes;
             perThreadPool.Recycle(dwpt);
             Debug.Assert(AssertMemory());
         }
         finally
         {
             try
             {
                 UpdateStallState();
             }
             finally
             {
                 Monitor.PulseAll(this);
             }
         }
     }
 }
        /* Remove a previously-registered hook.  Like the add method, this method
         * does not do any security checks.
         */
        internal static bool Remove(Thread hook)
        {
            lock (typeof(ApplicationShutdownHooks))
            {
                if (Hooks == null)
                {
                    throw new IllegalStateException("Shutdown in progress");
                }

                if (hook == null)
                {
                    throw new NullPointerException();
                }

                return(Hooks.Remove(hook) != null);
            }
        }
        public void UnregisterThreadLocalCleanupBean(IThreadLocalCleanupBean threadLocalCleanupBean)
        {
            Lock writeLock = listeners.GetWriteLock();

            writeLock.Lock();
            try
            {
                listeners.Unregister(threadLocalCleanupBean);
                cachedForkStateEntries = null;
                extensionToContextMap.Remove(threadLocalCleanupBean);
            }
            finally
            {
                writeLock.Unlock();
            }
            // clear this threadlocal a last time before letting the bean alone...
            threadLocalCleanupBean.CleanupThreadLocal();
        }
Beispiel #4
0
        protected bool EqualsCUDResult(CUDResultDiff cudResultDiff)
        {
            ICUDResult     left      = cudResultDiff.left;
            ICUDResult     right     = cudResultDiff.right;
            IList <Object> leftRefs  = left.GetOriginalRefs();
            IList <Object> rightRefs = right.GetOriginalRefs();

            if (leftRefs.Count != rightRefs.Count)
            {
                if (!cudResultDiff.doFullDiff)
                {
                    return(false);
                }
            }
            IList <IChangeContainer>       leftChanges  = left.AllChanges;
            IList <IChangeContainer>       rightChanges = right.AllChanges;
            IdentityHashMap <Object, int?> rightMap     = IdentityHashMap <Object, int?> .Create(rightRefs.Count);

            for (int a = rightRefs.Count; a-- > 0;)
            {
                rightMap.Put(rightRefs[a], a);
            }
            for (int a = leftRefs.Count; a-- > 0;)
            {
                Object leftEntity = leftRefs[a];
                int?   rightIndex = rightMap.Remove(leftEntity);
                if (!rightIndex.HasValue)
                {
                    if (!cudResultDiff.doFullDiff)
                    {
                        return(false);
                    }
                    cudResultDiff.diffChanges.Add(leftChanges[a]);
                    cudResultDiff.originalRefs.Add(leftEntity);
                    continue;
                }
                if (!EqualsChangeContainer(cudResultDiff, leftChanges[a], rightChanges[rightIndex.Value]))
                {
                    if (!cudResultDiff.doFullDiff)
                    {
                        if (cudResultDiff.containerBuild != null)
                        {
                            throw new Exception();
                        }
                        return(false);
                    }
                    cudResultDiff.diffChanges.Add(cudResultDiff.containerBuild);
                    cudResultDiff.originalRefs.Add(rightRefs[rightIndex.Value]);
                    cudResultDiff.containerBuild = null;
                }
                else if (cudResultDiff.containerBuild != null)
                {
                    throw new Exception();
                }
            }
            if (rightMap.Count == 0)
            {
                return(true);
            }
            foreach (Entry <Object, int> entry in rightMap)
            {
                Object           rightRef    = entry.Key;
                int              rightIndex  = entry.Value;
                IChangeContainer rightChange = rightChanges[rightIndex];
                cudResultDiff.diffChanges.Add(rightChange);
                cudResultDiff.originalRefs.Add(rightRef);
            }
            return(false);
        }