Multithread Barcode Reading

Overview

Aspose.BarCode for Java contains class BarCodeReader that is intended to perform barcode reading based on machine vision algorithms. This type of algorithm allows developers to implement parallel processing and thus increase recognition speed by distributing calculations across several CPU cores.

To perform multithread barcode reading, class BarCodeReader includes a special class called ProcessorSettings that allows optimizing the load of available CPU cores. Multithreading settings can be managed for all BarCodeReader objects and usually do not need special tuning.

Manual Multithread Settings

To manage multithread barcode reading manually, developers can use the following methods:

  • setUseAllCores and setUseOnlyThisCoresCount methods allow setting the maximum number of CPU cores available to complete one reading operation. The number of required threads is defined automatically.
  • setMaxAdditionalAllowedThreads sets the maximum number of threads available for parallel processing of all active BarCodeReader instances. The recommended value of this parameter is twice than the value of setUseOnlyThisCoresCount or the overall number of CPU cores when setUseAllCores.TRUE is enabled.

Single-Thread Recognition

If only single-thread barcode reading is available and the use of additional CPU cores should be blocked, developers can implement corresponding settings using setUseAllCores, UseOnlyThisCoresCount, and setMaxAdditionalAllowedThreads of class ProcessorSettings.

Use Fixed Number of Cores

To fix the number of CPU cores available for barcode reading processes, developers can apply corresponding settings through setUseAllCores, setUseOnlyThisCoresCount, and setMaxAdditionalAllowedThreads methods of class ProcessorSettings.

Automated Maximal Capacity Settings

To enable automated allocation of the maximally possible multithreading, corresponding settings can be applied. Class BarCodeReader determines the number of cores automatically.