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

asked 28 Oct '14, 23:23

nirav's gravatar image

nirav
11

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?

(29 Oct '14, 14:03) olga_parmenova ♦♦

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

(29 Oct '14, 21:00) nirav

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.

link

answered 30 Oct '14, 11:01

olga_parmenova's gravatar image

olga_parmenova ♦♦
111

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 } }

link

answered 09 Sep '15, 12:06

ravibeli's gravatar image

ravibeli
112

edited 09 Sep '15, 12:14

Please refer to this thread for an answer.

(09 Sep '15, 18:17) Julia Anikus... ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×47

Asked: 28 Oct '14, 23:23

Seen: 2,336 times

Last updated: 09 Sep '15, 18:17

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal