By checking groovy lang plugin source code I found next steps in code
execution:
Code compilation into script class
Script initialization via static method newInstance()
Script execution via calling the code on each document with binding
document parameters
Now assume I have class declaration in my script. Is it possible to execute
class definition and class object initialization only once, and execute
only a method from this object on each document?
Actually here i variable is not thread-safe, but idea is clean - you need
define a class, inherited from Script and implement abstract method run.
Also this class is access on each node-thread.
Now I'm looking for a solution to make a query-scope type counter (for
one-node configuration). I think it's could be done by passing unique
query_id in parameters, but I'm afraid of making code non thread safe, or
vice versa - thread safe, but with reduce performance.
Researching more...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.