<div dir="ltr">Hi,<br><br>I am developing a web service that evaluates risks on a certain fact, I accumulate the risks in the working memory (stateless working memory), but i need to return the asserted risks from the web service<br>
<br>the web method signature is like public Risks assertFact(Fact fact)<br>where Risks: <br> factId <br> Risk[]<br><br>The operation of insertion of a fact into the working memory is thread safe (there is a lock object invoked in the execute or insert operation). I need to know if i called workingMemory.executeWithResults() and getting the global variable , are these results thread safe ?<br>
<br>public Risks assertFact(Fact fact){<br><div style="margin-left: 40px;">...<br></div><div style="margin-left: 40px;">synchronized(workingMemory){<br> StatelessSessionResult result = workingMemory.executeWithResults(fact);<br>
risks = result.getGlobal("xyz");<br>}<br>...<br>return risks<br></div>}<br><br><br>it would be better to remove the synchronized block , but I don't know if this is okay or not.<br><br>Thanks in advance.<br>
<br>Best regards,<br>-- <br>Waleed Zedan<br><br><br>
</div>