LiveIndexWriterConfig中获得indexingChain和indexerThreadPool, 然后在生成DocumentsWriter时初始化indexerThreadPool, 在初始化时会生成DocumentsWriterPerThread和ThreadState的一一对应关系,在生成DocumentsWriterPerThread时,会调用IndexingChain的getChain方法。这样每个DocumentsWriterPerThread就获得了自己的indexingChain.这样在调用dwpt的updateDocument方法时就会逐一调用indexingChain中的consumer.
lucene的indexingChain的生成,主要涉及两个类LiveIndexWriterConfig和DocumentsWriter.
LiveIndexWriterConfig中获得indexingChain和indexerThreadPool, 然后在生成DocumentsWriter时初始化indexerThreadPool, 在初始化时会生成DocumentsWriterPerThread和ThreadState的一一对应关系,在生成DocumentsWriterPerThread时,会调用IndexingChain的getChain方法。这样每个DocumentsWriterPerThread就获得了自己的indexingChain.这样在调用dwpt的updateDocument方法时就会逐一调用indexingChain中的consumer.
LiveIndexWriterConfig中获得indexingChain和indexerThreadPool, 然后在生成DocumentsWriter时初始化indexerThreadPool, 在初始化时会生成DocumentsWriterPerThread和ThreadState的一一对应关系,在生成DocumentsWriterPerThread时,会调用IndexingChain的getChain方法。这样每个DocumentsWriterPerThread就获得了自己的indexingChain.这样在调用dwpt的updateDocument方法时就会逐一调用indexingChain中的consumer.
转载于:https://my.oschina.net/u/138995/blog/178950