[rules-users] rules-users Digest, Vol 89, Issue 11

Mallikarjun Kohalli (mkohalli) mkohalli at cisco.com
Thu Apr 3 04:27:39 EDT 2014


Hi All,
  I have a single thread executing all my rules in DROOLS 5.1.0.Can I enable multiple threads to be running in the drools using  thread pool to execute the rules so that execution can be faster .
I would like to know the configurations that should be made in 5.1.0 verison .


Regards,
Mallikarjun K

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Thursday, April 03, 2014 1:13 PM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 89, Issue 11

Send rules-users mailing list submissions to
	rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
	rules-users-request at lists.jboss.org

You can reach the person managing the list at
	rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: External Imports (Michael Anstis)
   2. Re: Memory leak due CompositeClassLoader (Romain Thouvenin)
   3. Re: Random rule fire (Wolfgang Laun)
   4. Re: Random rule fire (Wolfgang Laun)
   5. Re: Drools 6 and OSGi (Florian Pirchner)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Apr 2014 07:03:09 +0100
From: Michael Anstis <michael.anstis at gmail.com>
Subject: Re: [rules-users] External Imports
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CAAG9P0vfshuCiYWhpVEBJvOe3Eh58xj3RdCYCdRYte0YeCW07A at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

These should be added as "Import suggestions" in the Project Editor in the Authoring Perspective.

Sent on the move
On 2 Apr 2014 22:22, "vvicky72" <vvicky72 at hotmail.com> wrote:

> I am using the latest drools wb on jboss as7.
>
> Trying to add java.lang.ArrayList to the project.imports. But the New 
> item button is disabled. Screen shot attached. Any ideas?
> <http://drools.46999.n3.nabble.com/file/n4029102/DroolsCannotImport.jp
> g>
>
> Thanks,
> Vikas.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/External-Imports-tp4029102.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140403/e76915e1/attachment-0001.html 

------------------------------

Message: 2
Date: Thu, 3 Apr 2014 11:53:54 +0530
From: Romain Thouvenin <romain.thouvenin at amadeus.com>
Subject: Re: [rules-users] Memory leak due CompositeClassLoader
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<OFE4B455CB.4BE0DA1A-ONC1257CAF.00224DD0-65257CAF.00232498 at amadeus.com>
	
Content-Type: text/plain; charset="us-ascii"

The thing is that it is not my webapp that creates the RuleBaseConfiguration and the RuleBase, it is another component that is loaded by the application server, and the rules are shared between webapps. So I cannot dispose of these objects. This other component loads lazily the RuleBase on first call, that is why when the RuleBaseConfiguration is instantiated, the context class loader is the one of my webapp.

The only workaround I found is to hook a listener when my webapp is deployed, temporarily change the context class loader of the current Thread, force the load of the RuleBase.
That way the CompositeClassLoader does not have a reference to the class loader of my webapp.
But that is quite ugly...

I will see with the developers of this other component if migrating to 6.x is a possibility, but I doubt it in the near future.

Thanks anyway for the suggestions.
Romain




From:   Davide Sottara <dsotty at gmail.com>
To:     rules-users at lists.jboss.org, 
Date:   03/04/2014 00:29
Subject:        Re: [rules-users] Memory leak due CompositeClassLoader
Sent by:        rules-users-bounces at lists.jboss.org



You may have to dispose the sessions explicitly - or even the knowledgebase, using the internal method that was added as a temporary "brute force" 
patch
to leaks in 5.6.
The composite classloader was replaced in 6.x, so the newer versions should not have this kind of problems.
Best
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-due-CompositeClassLoader-tp4029053p4029100.html

Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140403/3569eaf0/attachment-0001.html 

------------------------------

Message: 3
Date: Thu, 3 Apr 2014 09:04:11 +0200
From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] Random rule fire
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CANaj1LfkaV33ZMsRn-=KpncdURzBw-13aFJrZyBddTfNtfL9ig at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

You can insert a fact containing the random number and add a pattern with the constraint. Where is the problem?


On 2 April 2014 23:45, vvicky72 <vvicky72 at hotmail.com> wrote:

> We have a unique situation. Using guided decision tables, we want a 
> particular rule to fire randomly even when all the conditions on the "when"
> clause are satisfied.
>
> So...
> We want to assign a positive integer to every rule (say n). We want 
> that rule to fire only when "new Random().nextInt(n)+1 = n" is true 
> (along with other conditions in the
> rule)
>
> Any suggestions?
>
> Thanks,
> Vikas.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Random-rule-fire-tp4029103.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140403/d7b57322/attachment-0001.html 

------------------------------

Message: 4
Date: Thu, 3 Apr 2014 09:38:19 +0200
From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] Random rule fire
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CANaj1LfhbLi_s9eZ6CvN2mecFrxtGnduMBKgb8oyHsrJAJ_QRw at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Second thoughts: it might be easier to add code to the right hand side to achieve this random firing.


On 3 April 2014 09:04, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

> You can insert a fact containing the random number and add a pattern 
> with the constraint. Where is the problem?
>
>
> On 2 April 2014 23:45, vvicky72 <vvicky72 at hotmail.com> wrote:
>
>> We have a unique situation. Using guided decision tables, we want a 
>> particular rule to fire randomly even when all the conditions on the 
>> "when"
>> clause are satisfied.
>>
>> So...
>> We want to assign a positive integer to every rule (say n). We want 
>> that rule to fire only when "new Random().nextInt(n)+1 = n" is true 
>> (along with other conditions in the
>> rule)
>>
>> Any suggestions?
>>
>> Thanks,
>> Vikas.
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Random-rule-fire-tp4029103.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140403/a01c9075/attachment-0001.html 

------------------------------

Message: 5
Date: Thu, 03 Apr 2014 09:43:06 +0200
From: Florian Pirchner <florian.pirchner at gmail.com>
Subject: Re: [rules-users] Drools 6 and OSGi
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID: <533D110A.3000901 at gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Thanks,

will try the latest build.

Best, Florian



Am 03.04.14 00:12, schrieb Mark Proctor:
>
>>  I did not get the idea behind it. Why don't you use "new" to create 
>> new instances. Then the bundles have to define their dependencies 
>> very carefully to become compiled.
> At the point where you see Class.forName it means the implementation 
> is not on the class path of that module, but the interface is. So the 
> provider pattern mechanism uses reflection to load the instance to 
> return to you under the targeted interface. This is how all our 
> factories work, we have all the api in -api but none of the 
> implementation. It binds the implementation at runtime, via 
> reflection. However, in the case of our -api factories, we already 
> address this in OSGi by using Activator injection.
>
>> My question is about the architecture changes to meet OSGi 
>> requirements. There are a lot of Class#forName calls to create new 
>> instances. In OSGi it is not that easy then in java SE. Each bundle 
>> has its own class loader. And classes are only visible to bundles, if 
>> their package was imported.
> We have not done a full audit of Class.forName. I should add that 
> loadClass itself has problems too, related to serialisation - which is 
> why we use forName. If you want to do an audit and submit via a pull 
> request alternatives, then  please do. Although remember not all those 
> forNames (in the case of our factories) will b used by OSGi, so make 
> sure you find ones that you believe are actually a problem.
>
> We also did work around making sure all our jars have unique package 
> names, to avoid split packages. And there was a lot of work around 
> repacking our dependencies.
>
>> So my question is, whether that approach is the suggested way to add 
>> Drools and JBPM to OSGi containers.
> Sorry I don't understand the question fully. The classloader argument, 
> is if you need to specify parent classloader. There are a variety of 
> use cases for this, such as if people are doing runtime code 
> generation on custom classloaders that they want to make visible to 
> Drools.
>
> My understanding is that drools now works on karaf. Maybe try one of 
> our latest builds if there any issues, then come back and let us know.
> http://downloads.jboss.org/drools/release/snapshot/master/
>
> Mark
>
> On 2 Apr 2014, at 20:51, Florian Pirchner <florian.pirchner at gmail.com 
> <mailto:florian.pirchner at gmail.com>> wrote:
>
>> Hi Mark,
>>
>> could not find anybody in cc :D
>>
>> Good to hear, that there is progress in the OSGi stuff.
>>
>> My question is about the architecture changes to meet OSGi 
>> requirements. There are a lot of Class#forName calls to create new 
>> instances. In OSGi it is not that easy then in java SE. Each bundle 
>> has its own class loader. And classes are only visible to bundles, if 
>> their package was imported.
>>
>> I could see, that there is a ProjectClassLoader. And that there is a 
>> way to provide a common parent classloader. That might be the bundle 
>> classloader. So most of the classes can be found by Class#forName.
>> But it requires a bundle, that imports all the dependencies from 
>> drools, kie and jbpm. Only in that case, the bundles are visible to 
>> the bundles class loader. So my question is, whether that approach is 
>> the suggested way to add Drools and JBPM to OSGi containers.
>>
>> But a drawback is, that there is no real support about required 
>> dependencies during development. Except the drools bundles will 
>> define their imported packages very carefully. Why do you use 
>> Class#forName to load classes? I did not get the idea behind it. Why 
>> don't you use "new" to create new instances. Then the bundles have to 
>> define their dependencies very carefully to become compiled.
>>
>> Thanks a lot for your answers.
>>
>> Best Florian
>>
>>
>>
>>
>>
>> 2014-03-31 18:28 GMT+02:00 Mark Proctor <mproctor at codehaus.org
>> <mailto:mproctor at codehaus.org>>:
>>
>>     There was a lot of OSGi fixes in 6.0.1, aimed at the karat
>>     container. However not all modules are migrated, as it's a work
>>     in progress. I don't know which currently are or are not, I'm
>>     cc'ing in the developer behind this to answer.
>>
>>     Mark
>>     On 31 Mar 2014, at 16:49, Florian Pirchner
>>     <florian.pirchner at gmail.com <mailto:florian.pirchner at gmail.com>>
>>     wrote:
>>
>>>     Hi,
>>>
>>>     today i started to setup Drools 6 in my OSGi container. But it
>>>     seems there are some issues that do not allow to run drools 6
>>>     (and jbpm) under OSGi properly.
>>>
>>>     For instance:
>>>     JPAKnowledgeService
>>>     .newStatefulKnowledgeSession(kieBase, null, env);
>>>     will never find
>>>     "org.drools.persistence.jpa.KnowledgeStoreServiceImpl" since it
>>>     is not in the scope of the current ClassLoader.
>>>
>>>     Tried to tie things up, but then there would be a cyclic
>>>     dependency between kie-internal and jbpm-persistence-jpa.
>>>
>>>     I also could see, that a ProjectClassLoader was added. I found a
>>>     way to put my current BundleClassLoader as its parent into play.
>>>     This solves a lot of class loading issues.
>>>
>>>
>>>     For me it seems, that Drools 6 was not designed to run in an
>>>     OSGi container. Is there ongoing work to integrate Drools and
>>>     JBPM Version 6.x into OSGi environments properly?
>>>
>>>     -- 
>>>     Thanks for your answer
>>>     Florian Pirchner
>>>
>>>     _______________________________________________
>>>     rules-users mailing list
>>>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>>>     https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>     _______________________________________________
>>     rules-users mailing list
>>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>>     https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140403/b443f06e/attachment.html 

------------------------------

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

End of rules-users Digest, Vol 89, Issue 11
*******************************************



More information about the rules-users mailing list