whenever you create RuntimeEngine you need to dispose it once you're done working on it. Regardless if you use KieSession or TaskService as both will be created and initialized.
Alternatively for query related operations on task service you can create instance of TaskService that will be "standalone" mode meaning not connected to any KieSession. That instance can be used for read only operations like query. To create an instance of it you can either use CDI (if you use CDI) or use HumanTaskServiceFactory to get configurator object that allows you to configure TaskService instance according to your needs.
Thanks Maciej. This was really helpful.
Can you please provide me some example to use HumanTaskServiceFactory to configure Task Services (Preferably Mina HT Service similar to one used in jbpm5.4)?
Thanks Maciej. will explore more on this.