I have a class that implements Runnable , and I'm currently using Executor as a thread pool for running tasks (indexing documents in Lucene).
executor.execute(new LuceneDocIndexer(doc, writer));
My problem is that my Runnable class creates many Lucene Field objects, and I would rather reuse them and then create new ones for each call. What is the best way to reuse these objects ( Field objects are not thread safe, so I cannot make them static) - should I create my own ThreadFactory ? I notice that after a while the program starts to deteriorate sharply, and the only thing I can think of is the GC overhead. I'm currently trying to profile the project to be sure that this is even a problem, but for now, let's just assume that it is.
source share