Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
ParserThread.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 using System;
19 using Lucene.Net.Support;
20 
21 namespace Lucene.Net.Demo.Html
22 {
23 
25  {
26  internal HTMLParser parser;
27 
28  internal ParserThread(HTMLParser p)
29  {
30  parser = p;
31  }
32 
33  override public void Run()
34  {
35  // convert pipeOut to pipeIn
36  try
37  {
38  try
39  {
40  // parse document to pipeOut
41  parser.HTMLDocument();
42  }
43  catch (ParseException e)
44  {
45  System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
46  }
47  catch (TokenMgrError e)
48  {
49  System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
50  }
51  finally
52  {
53  parser.pipeOut.Close();
54  lock (parser)
55  {
56  parser.summary.Length = HTMLParser.SUMMARY_LENGTH;
57  parser.summaryComplete = true;
58  parser.titleComplete = true;
59  System.Threading.Monitor.PulseAll(parser);
60  }
61  }
62  }
63  catch (System.IO.IOException e)
64  {
65  System.Console.Error.WriteLine(e.StackTrace);
66  }
67  }
68  }
69 }