public static synchronized void indexDocument(CodeIndexDocument codeIndexDocument) throws IOException {
  Queue<CodeIndexDocument> queue=new ConcurrentLinkedQueue<>();
  queue.add(codeIndexDocument);
  indexDocuments(queue);
  queue=null;
}

public static synchronized void indexDocument ( CodeIndexDocument codeIndexDocument ) throws IOException { Queue < CodeIndexDocument > queue = new ConcurrentLinkedQueue < > ( ) ; queue . add ( codeIndexDocument ) ; indexDocuments ( queue ) ; queue = null ; }
possibly better in ultra low memory environments ? reuses the above method by creating a queue with one element and passes it in .
