<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>I am new to Drools (Expert and Fusion) and have been reading through the materials over the last few days. After going through some of the tutorial code I wrote a very quick and dirty to perform a base assessment of the speed of Fusion / Expert. My code is below. The strange thing I'm currently receiving is, if I insert 100k events the test completes successfully, if I insert 150k events, I receive a ConsequenceException caused by an NPE. Being new to Drools I must be doing something wrong, can anyone please provide some guidance?<br>
<br></div>(Main function)<br></div>Counter cc = new Counter ();<br></div>session.insert (cc);<br></div>for (int i = 0; i < 150000; i++) {<br></div> entryPoint01.insert (new MyEvent ());<br>}<br><br></div>(Counter Class)<br>
</div>public class Counter {<br></div> private long total = 0;<br></div> // get / set total<br></div><div> public void addValue (int val) {<br></div><div> total += val;<br> }<br></div><div>}<br><br></div>(MyEvent Class)<br>
</div>public class MyEvent {<br></div> private int value = 1;<br></div> // get / set value<br>}<br><br></div>(DRL file)<br></div><div>declare MyEvent<br></div><div> @role (event)<br></div><div> @expires (1s)<br>end<br>
<br></div>rule "Count the rules"<br></div>when<br></div> $ev : MyEvent () from entry-point entryPoint01<br></div> $pc : Counter ()<br></div>then<br></div> $cc.addValue ($ev.getValue ());<br></div>end<br></div>