Out-of-Process Server Implementation
This method of loading allows you to load ABBYY FineReader Engine as an out-of-process server into a separate process. If this loading method is used, all ABBYY FineReader Engine objects are completely thread-safe. Each FineReader Engine instance runs in a separate process simultaneously with the other instances. It allows you to create a pool of processors and make full use of the available CPU power. For this reason, using this method is particularly suitable for server applications.
For loading Engine into a separate process as an out-of-process server use the files provided in the distribution:
- The OutprocEngineLoader.h file declares initialization and deinitialization methods of the Engine object (for C++ use the InitializeEngine and ExplicitlyUnload functions declared in this header file).
- The FREgnineOutproc.h file is included in the OutprocEngineLoader.h. It is an analog of the FREngine.h file for multi-threaded solutions that supports the same methods and interfaces except for the methods for reference counting and methods with SAFEARRAY parameters.
- The methods declared in FREngineOutproc.h do not handle reference cycles. That is why a specific implementation of SafePtr is represented in the OutprocSafePtr.h file, which you can find in the code samples describing the loading as an out-of-process server. You can include this header file or create your own.
- Every loading of the Engine into a separate process requires one TCP port. The configuration file OutprocConfig.ini contains the interval of available ports for inter-process communication.
- If your application works with С++, additionally link the libOutprocClientLib.so library in your project.
- If you work with Java wrapper, use com.abbyy.Outproc.FREngine.jar instead of com.abbyy.FREngine.jar. These files are included in ABBYY FineReader Engine distribution package.
See Hello (Outproc) and Multithreading code samples, which demonstrate loading the Engine as an out-of-process server and provide a reusable solution for multi-threaded applications for C++ and Java.
The Engine object loaded as an out-of-process server has peculiarities of using ABBYY FineReader Engine objects and methods:
- You must specify the sequential mode of document processing by setting the MultiProcessingMode property of the MultiProcessingParams object to MPM_Sequential.
- You must pass NULL for parameters derived from IUnknown. These parameters are commonly used in export methods. To pass the export parameters in an alternative way, create a user profile with the desired settings.
- The Engine object loaded as an out-of-process server does not support working with:
- callbacks and methods with parameters derived from callbacks
- interfaces and methods for opening images from memory
You may also speed up the iteration of the document layout with the scheme described in Working with Layout and Blocks.
7/3/2024 8:50:25 AM