StatelessKnowledgeSessionImpl execute with command

62 views
Skip to first unread message

Dimitri Gamkrelidze

unread,
Oct 17, 2023, 2:04:09 PM10/17/23
to Drools Setup
Hello everyone,

When executing StatelessKnowledgeSession with command,  if it's BatchExecutionCommand , it forces the ServiceLoader to load Command service.
Cannot it be instanciated once? Most time is spend on this operation



public <T> T execute(Command<T> command) {
StatefulKnowledgeSession ksession = newWorkingMemory();

RegistryContext context = RegistryContext.create().register( KieSession.class, ksession );

try {
if ( command instanceof BatchExecutionCommand ) {
context.register( ExecutionResults.class, KieServices.get().getCommands().newExecutionResults() );
}
 
Screenshot from 2023-10-17 21-49-18.png
You can see same rules flamegraphs , when I made static field and reused the KIE_COMMAND
Screenshot from 2023-10-17 21-53-49.png

Thanks

Mario Fusco

unread,
Oct 19, 2023, 2:34:45 AM10/19/23
to drools...@googlegroups.com
Hi,

Great finding, thanks a lot for having reported it.


Thanks again,
Mario

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/d7738172-da79-4dcc-b530-b5593fa3d11en%40googlegroups.com.

Dimitri Gamkrelidze

unread,
Nov 8, 2023, 6:52:39 PM11/8/23
to Drools Setup
Thank you Mario.
Reply all
Reply to author
Forward
0 new messages