[
https://issues.apache.org/jira/browse/CAMEL-27841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27841:
--------------------------------
Description:
Found while improving the option descriptions of camel-optaplanner for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/387f7ff0b6ea13b1acc5d8ca1e8ae0ec8dbee737,
pull request https://github.com/apache/camel/pull/31143).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The async header on a non-async endpoint gives NullPointerException
{{OptaPlannerProducer.process}}: with async=false on the endpoint and
CamelOptaPlannerIsAsync=true on the exchange, executor.submit runs on a null
executor, because doStart creates the pool only when async=true.
Proposed change: create the pool when it is first needed, or ignore the header
without a pool.
h4. 2. Two exchanges on one endpoint at once always fail
The problemId is fixed per endpoint, and DefaultSolverManager.solve throws "The
problemId (1) is already solving" while a job with that id runs. So async with
threadPoolSize > 1 gains nothing unless each exchange passes its own
SolverManager.
Proposed change: add a problemId header, or document one problem at a time per
endpoint.
h4. 3. solverId and CamelOptaPlannerSolverId are never read
In {{OptaPlannerEndpoint}} the solvers map, getOrCreateSolver, getSolver and
createSolver are dead code from before the switch to SolverManager.
Proposed change: deprecate the option and header and remove the dead code.
h4. 4. The solver config is loaded with the thread context class loader
{{OptaPlannerEndpoint.getOrCreateSolverManager}} calls
SolverConfig.createFromXmlResource(configFile) without a class loader.
Proposed change: pass getCamelContext().getApplicationContextClassLoader().
_Claude Code on behalf of davsclaus_
was:
Found while improving the option descriptions of camel-optaplanner for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31143).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The async header on a non-async endpoint gives NullPointerException
{{OptaPlannerProducer.process}}: with async=false on the endpoint and
CamelOptaPlannerIsAsync=true on the exchange, executor.submit runs on a null
executor, because doStart creates the pool only when async=true.
Proposed change: create the pool when it is first needed, or ignore the header
without a pool.
h4. 2. Two exchanges on one endpoint at once always fail
The problemId is fixed per endpoint, and DefaultSolverManager.solve throws "The
problemId (1) is already solving" while a job with that id runs. So async with
threadPoolSize > 1 gains nothing unless each exchange passes its own
SolverManager.
Proposed change: add a problemId header, or document one problem at a time per
endpoint.
h4. 3. solverId and CamelOptaPlannerSolverId are never read
In {{OptaPlannerEndpoint}} the solvers map, getOrCreateSolver, getSolver and
createSolver are dead code from before the switch to SolverManager.
Proposed change: deprecate the option and header and remove the dead code.
h4. 4. The solver config is loaded with the thread context class loader
{{OptaPlannerEndpoint.getOrCreateSolverManager}} calls
SolverConfig.createFromXmlResource(configFile) without a class loader.
Proposed change: pass getCamelContext().getApplicationContextClassLoader().
_Claude Code on behalf of davsclaus_
> camel-optaplanner: an async header on a non-async endpoint gives
> NullPointerException, concurrent exchanges on one endpoint fail
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27841
> URL: https://issues.apache.org/jira/browse/CAMEL-27841
> Project: Camel
> Issue Type: Bug
> Components: camel-optaplanner
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-optaplanner for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/387f7ff0b6ea13b1acc5d8ca1e8ae0ec8dbee737,
> pull request https://github.com/apache/camel/pull/31143).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. The async header on a non-async endpoint gives NullPointerException
> {{OptaPlannerProducer.process}}: with async=false on the endpoint and
> CamelOptaPlannerIsAsync=true on the exchange, executor.submit runs on a null
> executor, because doStart creates the pool only when async=true.
> Proposed change: create the pool when it is first needed, or ignore the
> header without a pool.
> h4. 2. Two exchanges on one endpoint at once always fail
> The problemId is fixed per endpoint, and DefaultSolverManager.solve throws
> "The problemId (1) is already solving" while a job with that id runs. So
> async with threadPoolSize > 1 gains nothing unless each exchange passes its
> own SolverManager.
> Proposed change: add a problemId header, or document one problem at a time
> per endpoint.
> h4. 3. solverId and CamelOptaPlannerSolverId are never read
> In {{OptaPlannerEndpoint}} the solvers map, getOrCreateSolver, getSolver and
> createSolver are dead code from before the switch to SolverManager.
> Proposed change: deprecate the option and header and remove the dead code.
> h4. 4. The solver config is loaded with the thread context class loader
> {{OptaPlannerEndpoint.getOrCreateSolverManager}} calls
> SolverConfig.createFromXmlResource(configFile) without a class loader.
> Proposed change: pass getCamelContext().getApplicationContextClassLoader().
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)