Bug 739830

Summary: Some imported packages are not listed in JMX
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Tomas Schlosser <tschloss>
Component: BRE (Expert, Fusion), JONAssignee: Nobody <nobody>
Status: VERIFIED --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: BRMS 5.2.0.GACC: mproctor
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Simple test case none

Description Tomas Schlosser 2011-09-20 07:37:02 UTC
Created attachment 523964 [details]
Simple test case

Description of problem:
When inspecting KnowledgeBase through jConsole I can't see packages:
- imported using .* (eg. org.sample.*)
- imported by listing all used classes (unless at least one of them is event)

Version-Release number of selected component (if applicable):
BRMS 5.2.0.ER4

How reproducible:
every time

Steps to Reproduce:
1. run the included test case
2. inspect the running application with jConsole
  
Actual results:
org.jboss.qa.brms.jmx is listed
org.jboss.qa.brms.jmx.pkg1 is listed
org.jboss.qa.brms.jmx.pkg2 is not listed

Expected results:
either
org.jboss.qa.brms.jmx is listed
org.jboss.qa.brms.jmx.pkg1 is listed
org.jboss.qa.brms.jmx.pkg2 is listed

or

org.jboss.qa.brms.jmx is listed
org.jboss.qa.brms.jmx.pkg1 is not listed
org.jboss.qa.brms.jmx.pkg2 is not listed


Additional info:
If you remove SomeFact declaration as an event, the package pkg1 disappears from listing. On the other hand if you declare any (or all) class imported from pkg2 as event it is still not listed in packages.

Comment 2 Edson Tirelli 2012-01-26 16:19:02 UTC
I think this is a misunderstanding. The Drools MBeans do not show imported packages... they show packages created by the engine when compiling rules.

Using the provided DRL as an example:

=====
package org.jboss.qa.brms.jmx

import org.jboss.qa.brms.jmx.pkg1.SomeFact
import org.jboss.qa.brms.jmx.pkg1.SomeOtherFact

import org.jboss.qa.brms.jmx.pkg2.*

declare SomeFact
	@role(event)
end

declare EmptyFact
	@role(event)
end

<rules>
=====

Because the file was declared as part of package "org.jboss.qa.brms.jmx", the engine will create a package object with that name to store all the rules, as well, as any additional data necessary (like type declarations for new facts in that package, etc).

If you take any existing class from a different package and declare metadata for it (in the above example, org.jboss.qa.brms.jmx.pk1.SomeFact and org.jboss.qa.brms.jmx.pkg2.EmptyFact are declared with @role(event)), then the engine creates the corresponding package objects to store that metadata.

Now, if one imports and use classes from package a.b.c, but does not declare any metadata for those classes, and drools does not need to store any compilation data for them, there is no reason for drools to create package objects for them, and so drools won't do it.

The actual import statements are just compile time information for the engine to find referenced classes, but they don't generate any visible entity by themselves.

Let me know if this clarifies the issue or if I am missing something.

Thanks

Comment 3 Ryan Zhang 2012-02-15 09:13:06 UTC
Please verify the issue on 5.3 ER4.

Comment 4 Tomas Schlosser 2012-02-22 08:38:10 UTC
Yes, this clarifies it. The "issue" is verified.