[
https://issues.jboss.org/browse/JBRULES-2700?page=com.atlassian.jira.plug...
]
Henrik Saksela commented on JBRULES-2700:
-----------------------------------------
Yeah I noticed the part about creating new WMs between phases; my first attempt att
solving this crudely injected the globals into the initial WM which worked until the first
phase ended.. Overriding the WM creation in RuleBase worked, but it wasn't a very
elegant solution :)
Still, if the globals were notified 1) at the beginning / end of solve() at this point, 2)
at the beginning / end of any spawned threads in the future, they could take care of the
their own thread safety using threadlocals. Of course, as long as planner isn't
multithreaded I can just implement the thread-specific stuff outside solver..
Allow setting a global variable (for example a service) which can be
used by the score rules
--------------------------------------------------------------------------------------------
Key: JBRULES-2700
URL:
https://issues.jboss.org/browse/JBRULES-2700
Project: Drools
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: drools-planner
Reporter: Wouter Horré
Assignee: Geoffrey De Smet
Currently, it is not possible to set a global variable in the working memory used by the
solver. If a scoring rule needs an external helper for calculating scores (e.g. a
dependency injected with OSGi DS), a workaround using a static variable in some class
accessible by the scoring rules is needed.
The easiest implementation is probably a new method in the Solver interface: //
Impossible
public WorkingMemory getWorkingMemory();
which provides access to the working memory used by the solver.
=> Impossible because the number of WorkingMemory equals the number of threads being
used by Planner, and sometimes they are reset.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira