Hi, It is actually brilliant idea! In current design every time function invoked new script engine instance is created and everything is reparsed. It allow to perform a parallel execution of several invocation, but I don't think that it worse it.
The best solution in my opinion would be caching prepared functions and make their invocation synchronous. So different functions still can execute in parallel, but the same function will be invoked in the same Nashorn instance and as a result you can use static variables between function invocation. However this approach has its disadvantages like possible memory leaks. Lets create an issue where we can discuss what would be the best implementation. Best regards, Artem Orobets * Orient Technologiesthe Company behind OrientDB* 2014-06-17 15:46 GMT+03:00 MrFT <[email protected]>: > Hello, > > I would like to check if documents adhere to a json-schema before doing > updates on the database, by using a javascript function. > > For this to work i need to load a library that can do > jsson-schema-validation, and a javascript object that describes the schema. > > I can do all this by calling other functions that create all that's > necessary, but that means that it has to be done every time again, even > though it would be more logical to *only load the library and the > json-schema once* (when the server starts or the first time the function > is called). > > Is this possible somehow? > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
