FineReader Engines Pool - Multithreading Java

  • Last Post 09 September 2015
nirav posted this 28 October 2014

How do you implement Engines Pool - Multithreading in Java and Tomcat

IEngineLoader loader = Engine.CreateEngineOutprocLoader(); IEngine engine = loader.GetEngineObject(GetDeveloperSN());

This throws null pointer exception

Order By: Standard | Newest | Votes
olga_parmenova posted this 29 October 2014

Do you get this exception when running our standard EnginesPool sample for Java without any changes? Do you have the same behavior for standard Hello sample for Java?

nirav posted this 29 October 2014

I have not seen any example in java related to Engines Pool. But engine.load works fine .

FYI i am using FineReader Engine 11 on linux

olga_parmenova posted this 30 October 2014

Loading Engine with InprocLoader or OutprocLoader is implemented using COM technology which is not supported on Linux systems. So, unfortunately, you cannot use these method of loading Engine on Linux.

ravibeli posted this 09 September 2015

Q: Does ABBYY FineReader 11 Linux version supports multi-threaded environement???

I want to load engine and get instance once and want to reuse for processing in multi-threading environment.

Pseudo code: pool_size: 3 (Getting it from config file) //This implementation standard Apache Commons object pool EnginePool pool = new EnginePool();

//create as no of pool size was configured those many Engine instances to be loaded //and added to the pool for(int i = 0; i < pool_size; i++) { IEngine engine = Engine.Load(engineBinPath, license); pool.addEngine(engine); }

//This method is called by multi-threads this is already synchronized and //this will be allowed to access only one thread at a time Output synchronized requestToProcessImage(String imagePath) { try { IEngine engine = pool.getEngine(); //TODO: here is my processing logic will be done where ICharParams cparams = engine.CreateCharParams(); paragraph.GetCharParams(k, cparams); if(cparams.getIsWordStart() != null) { int left = cparams.getLeft(); //doing some more logical here } } catch (Exception e){ //log error message } finally { //after try this block should always execute pool.returnToPool(engine); //adding back to the pool after engine instance usage is done } }

Julia Anikushina posted this 09 September 2015

Please refer to this thread for an answer.