Ejemplo n.º 1
0
 private void NotifyCoreClosedListeners(Exception th)
 {
     lock (coreClosedListeners)
     {
         foreach (ICoreDisposedListener listener in coreClosedListeners)
         {
             // SegmentReader uses our instance as its
             // coreCacheKey:
             try
             {
                 listener.OnDispose(this);
             }
             catch (Exception t)
             {
                 if (th == null)
                 {
                     th = t;
                 }
                 else
                 {
                     th.AddSuppressed(t);
                 }
             }
         }
         IOUtils.ReThrowUnchecked(th);
     }
 }
Ejemplo n.º 2
0
        private void NotifyReaderClosedListeners(Exception th)
        {
            object syncRoot = ((ICollection)readerClosedListeners).SyncRoot;

            UninterruptableMonitor.Enter(syncRoot); // LUCENENET: Ensure we sync on the SyncRoot of ConcurrentSet<T>
            try
            {
                foreach (IReaderClosedListener listener in readerClosedListeners)
                {
                    try
                    {
                        listener.OnClose(this);
                    }
                    catch (Exception t) when(t.IsThrowable())
                    {
                        if (th is null)
                        {
                            th = t;
                        }
                        else
                        {
                            th.AddSuppressed(t);
                        }
                    }
                }
                IOUtils.ReThrowUnchecked(th);
            }
            finally
            {
                UninterruptableMonitor.Exit(syncRoot);
            }
        }
Ejemplo n.º 3
0
        private void NotifyCoreClosedListeners(Exception th)
        {
            object syncRoot = ((ICollection)coreClosedListeners).SyncRoot;

            UninterruptableMonitor.Enter(syncRoot);
            try
            {
                foreach (ICoreDisposedListener listener in coreClosedListeners)
                {
                    // SegmentReader uses our instance as its
                    // coreCacheKey:
                    try
                    {
                        listener.OnDispose(this);
                    }
                    catch (Exception t) when(t.IsThrowable())
                    {
                        if (th == null)
                        {
                            th = t;
                        }
                        else
                        {
                            th.AddSuppressed(t);
                        }
                    }
                }
                IOUtils.ReThrowUnchecked(th);
            }
            finally
            {
                UninterruptableMonitor.Exit(syncRoot);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Since there's no C# equivalent of Java's Exception.AddSuppressed, we add the
 /// suppressed exceptions to a data field via the
 /// <see cref="Support.ExceptionExtensions.AddSuppressed(Exception, Exception)"/> method.
 /// <para/>
 /// The exceptions can be retrieved by calling <see cref="ExceptionExtensions.GetSuppressed(Exception)"/>
 /// or <see cref="ExceptionExtensions.GetSuppressedAsList(Exception)"/>.
 /// </summary>
 /// <param name="exception"> this exception should get the suppressed one added </param>
 /// <param name="suppressed"> the suppressed exception </param>
 private static void AddSuppressed(Exception exception, Exception suppressed)
 {
     if (exception != null && suppressed != null)
     {
         exception.AddSuppressed(suppressed);
     }
 }
Ejemplo n.º 5
0
 private void NotifyReaderClosedListeners(Exception th)
 {
     lock (((ICollection)readerClosedListeners).SyncRoot) // LUCENENET: Ensure we sync on the SyncRoot of ConcurrentSet<T>
     {
         foreach (IReaderClosedListener listener in readerClosedListeners)
         {
             try
             {
                 listener.OnClose(this);
             }
             catch (Exception t)
             {
                 if (th == null)
                 {
                     th = t;
                 }
                 else
                 {
                     th.AddSuppressed(t);
                 }
             }
         }
         IOUtils.ReThrowUnchecked(th);
     }
 }
Ejemplo n.º 6
0
 private void NotifyReaderClosedListeners(Exception th)
 {
     lock (readerClosedListeners)
     {
         foreach (IReaderClosedListener listener in readerClosedListeners)
         {
             try
             {
                 listener.OnClose(this);
             }
             catch (Exception t)
             {
                 if (th == null)
                 {
                     th = t;
                 }
                 else
                 {
                     th.AddSuppressed(t);
                 }
             }
         }
         IOUtils.ReThrowUnchecked(th);
     }
 }