Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotLeakTasksOnCrash()
        public virtual void MustNotLeakTasksOnCrash()
        {
            // Given
            string exceptionMessage                = "When there's no more room in hell, the dead will walk the earth";
            CrashGenerationCleaner cleaner         = NewCrashingCrashGenerationCleaner(exceptionMessage);
            ExecutorService        executorService = Executors.newFixedThreadPool(Runtime.Runtime.availableProcessors());

            try
            {
                // When
                cleaner.Clean(executorService);
                fail("Expected to throw");
            }
            catch (Exception e)
            {
                Exception rootCause = Exceptions.rootCause(e);
                assertTrue(rootCause is IOException);
                assertEquals(exceptionMessage, rootCause.Message);
            }
            finally
            {
                // Then
                IList <ThreadStart> tasks = executorService.shutdownNow();
                assertEquals(0, tasks.Count);
            }
        }
Example #2
0
 /// <param name="crashGenerationCleaner"> <seealso cref="CrashGenerationCleaner"/> to use for cleaning. </param>
 /// <param name="gbpTreeLock"> <seealso cref="GBPTreeLock"/> to be released when job has either successfully finished or failed. </param>
 /// <param name="monitor"> <seealso cref="GBPTree.Monitor"/> to report to </param>
 /// <param name="indexFile"> Target file </param>
 internal GBPTreeCleanupJob(CrashGenerationCleaner crashGenerationCleaner, GBPTreeLock gbpTreeLock, GBPTree.Monitor monitor, File indexFile)
 {
     this._crashGenerationCleaner = crashGenerationCleaner;
     this._gbpTreeLock            = gbpTreeLock;
     this._monitor   = monitor;
     this._indexFile = indexFile;
     this._needed    = true;
 }