コード例 #1
0
 public override void Run()
 {
     for (int i = 0; i < 10000; i++)
     {
         try
         {
             string[] files = outerBDWrapper.ListAll();
             foreach (string file in files)
             {
                 try
                 {
                     IndexInput input = outerBDWrapper.OpenInput(file, NewIOContext(Random()));
                 }
                 catch (FileNotFoundException fne)
                 {
                 }
                 catch (IOException e)
                 {
                     if (!e.Message.Contains("still open for writing"))
                     {
                         throw new Exception(e.Message, e);
                     }
                 }
                 if (Random().NextBoolean())
                 {
                     break;
                 }
             }
         }
         catch (IOException e)
         {
             throw new Exception(e.Message, e);
         }
     }
 }
コード例 #2
0
            public override void Run()
            {
                for (int i = 0; i < 10000; i++)
                {
                    try
                    {
                        string[] files = outerBDWrapper.ListAll();
                        foreach (string file in files)
                        {
                            try
                            {
                                using (IndexInput input = outerBDWrapper.OpenInput(file, NewIOContext(Random()))) { }
                            }
#pragma warning disable 168
                            catch (FileNotFoundException fne)
#pragma warning restore 168
                            {
                            }
                            // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
                            // in Lucene, we need to catch it here to be on the safe side.
                            catch (System.IO.DirectoryNotFoundException)
                            {
                            }
                            catch (IOException e)
                            {
                                if (!e.Message.Contains("still open for writing"))
                                {
                                    throw new Exception(e.ToString(), e);
                                }
                            }
                            if (Random().NextBoolean())
                            {
                                break;
                            }
                        }
                    }
                    catch (IOException e)
                    {
                        throw new Exception(e.ToString(), e);
                    }
                }
            }
コード例 #3
0
 public override void Run()
 {
     for (int i = 0; i < 10000; i++)
     {
         try
         {
             string[] files = outerBDWrapper.ListAll();
             foreach (string file in files)
             {
                 //System.out.println("file:" + file);
                 try
                 {
                     using IndexInput input = outerBDWrapper.OpenInput(file, NewIOContext(Random));
                 }
                 catch (Exception fne) when(fne.IsNoSuchFileExceptionOrFileNotFoundException())
                 {
                     // ignore
                 }
                 catch (Exception e) when(e.IsIOException())
                 {
                     // ignore
                     if (!e.Message.Contains("still open for writing"))
                     {
                         throw RuntimeException.Create(e);
                     }
                 }
                 if (Random.NextBoolean())
                 {
                     break;
                 }
             }
         }
         catch (Exception e) when(e.IsIOException())
         {
             throw RuntimeException.Create(e);
         }
     }
 }