Heap and scheduled Activations
by cyberdav@free.fr
Hi everyone,
I've wrote that rule:
rule "COMPTEUR"
duration 10000
when
$alarme : Alarm ();
then
$alarme.increment();
update($alarme);
end
Using JProfile, I've noticed that PropagationContextImpl was constantly growing
in the heap. Then, I looked the scheduled activations and saw that some
scheduledExecutionTime was expired. So, I wrote this code to purge the expired
activations:
Activation[] activations = session.getAgenda().getScheduledActivations();
long now = (new Date()).getTime();
for(int i=0;i<activations.length;i++){
if( now >
((org.drools.common.ScheduledAgendaItem)activations[i]).scheduledExecutionTime()){
activations[i].remove();
}
}
Now, the heap isn't growing anymore but what are the consequences of doing
something like that? So far, there are no noticeable regression on my
application.
Thanks for your help.
Dav.
16 years, 11 months
Problem running JBRMS 4.0.4 on JBoss AS 4.0.5 and AS 4.2.1 and AS 4.2.2
by cristian aliante
Problem running JBRMS 4.0.4 on JBoss AS 4.0.5 and as 4.2.1 and 4.2.2
I have problems in the run brms, don't start the loggin
I have install jdk 1.6.0_01
the error is:
11:42:18,000 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
11:42:18,015 INFO [JkMain] Jk running ID=0 time=0/47 config=null
11:42:18,031 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
CVSTag=Bran
ch_4_0 date=200610162339)] Started in 50s:391ms
11:42:25,609 INFO [STDOUT] ERROR 16-01 11:42:25,609 (
Contexts.java:flushAndDest
royContexts:335) could not discover transaction status
11:42:25,625 INFO [STDOUT] ERROR 16-01 11:42:25,609 (
Log4JLogger.java:error:119
) Servlet.service() for servlet default threw exception
java.lang.IllegalStateException: Cannot create a session after the response
has
been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java
:2214)
at org.apache.catalina.connector.Request.getSession(Request.java
:2024)
at org.apache.catalina.connector.RequestFacade.getSession
(RequestFacade.
java:831)
at org.jboss.seam.servlet.ServletRequestSessionMap.put
(ServletRequestSes
sionMap.java:87)
at org.jboss.seam.servlet.ServletRequestSessionMap.put
(ServletRequestSes
sionMap.java:25)
at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:80)
at org.jboss.seam.Component.newInstance(Component.java:1980)
at org.jboss.seam.Component.getInstance(Component.java:1878)
at org.jboss.seam.Component.getInstance(Component.java:1857)
at org.jboss.seam.Component.getInstance(Component.java:1834)
at org.jboss.seam.web.Session.getInstance(Session.java:122)
at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(
Contexts.jav
a:375)
at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:132)
at org.jboss.seam.servlet.ContextualHttpServletRequest.run
(ContextualHtt
pServletRequest.java:65)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter
(ReplyHeaderFi
lter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke
(Securit
yAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke
(JaccContextValv
e.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke
(CachedConne
ctionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.jav
a:148)
at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpo
int.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run
(MasterSlaveWor
kerThread.java:112)
at java.lang.Thread.run(Thread.java:619)
thanks for the help.
16 years, 11 months
Can't call static method in 'in' compound restriction?
by Gattiker, Alexandre
Thanks a lot, Edson, for the quick reply yesterday. Here's another one. The following rule compiles, but Drools crashes upon insertion of an object. Same when calling a static method instead of a constructor.
(Based on the Eclipse sample rule project)
rule "rule1"
when
$p1:Message(
message in (
(new String("A")),
(new String("B"))
)
)
then
System.out.println("foo");
end
java.lang.UnsupportedOperationException: does not support method call isAllowed(Object object, InternalWorkingMemory workingMemoiry)
at org.drools.rule.ReturnValueRestriction.isAllowed(ReturnValueRestriction.java:177)
at org.drools.rule.OrCompositeRestriction.isAllowed(OrCompositeRestriction.java:20)
at org.drools.rule.MultiRestrictionFieldConstraint.isAllowed(MultiRestrictionFieldConstraint.java:70)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:177)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
at com.sample.DroolsTest.main(DroolsTest.java:28)
I'm on drools 4.0.2 and mvel14-1.2.8.
Alexandre
16 years, 11 months
Splitted Sentences in DSL...
by mmquelo massi
Hi guys,
As u can notice in the
http://labs.jboss.com/file-access/default/members/drools/images//template...
DSL
pop-up Menu,
we have got the sentence "Escalate the ticket" splitted into 3 different
sub-sentences:
1. Escalate
2. Escalate the
3. Escalate the ticket
When I open "*org.drools.examples.TroubleTicketWithDSL.dslr*" from the "*
drools-examples/drools-examples-drl/src/main/rules/org/drools/examples*"
directory and i push "CTRL+SPACE" in Eclipse Europa 3.3, then the pop-up
menu I get back shows just one of the sentences above.
It just shows: "Escalate the ticket".
I expected to see all the above sentences, as I saw in the JBoss Drools
Features page (
http://labs.jboss.com/file-access/default/members/drools/images//template...
).
So.... Why Do I get a different menu with just one sentence?
Is the .dsl file referred from the .drls in the "feature page" different
from the following one?
*[condition][]There is a customer ticket with status of "{status}"=customer
: Customer( ) ticket : Ticket( customer == customer, status == "{status}"
)
[condition][]There is a "{subscription}" customer with a ticket status of
"{status}"=customer : Customer(subscription == "{subscription}") ticket :
Ticket( customer == customer, status == "{status}")
[consequence][]Log "{message}"=System.out.println("{message} ");
[consequence][]Escalate the ticket=ticket.setStatus("Escalate");
update(ticket);
[consequence][]Send escalation email=sendEscalationEmail( customer, ticket
);*
*One more question.*
I have got no idea on the "Object" column which accours in the DSL Editor.
We have got "Language Expression", "", "*Object*" and "Scope".
What does "*Object*" stand for?
Thank You for any help you can give me.
Massi
16 years, 11 months
Basic Question about Errors
by Markus Helbig
Hi,
it's a basic question but since half a year i am not sure how to read the error
[53,61]: unknown:53:61 Unexpected token '('[53,73]: unknown:53:73
mismatched token: [@771,2278:2278=')',<12>,53:73]; expecting type
THEN[65,61]:
which line/position is indicated in the corresponding rule file. Every
time, when i think now i got it the next error shows me i'm not right.
Cheers
Markus
16 years, 11 months
shadow copy lacks a property value of the original fact
by Henry Canterburry
I was just debugging my rules and monitored my working memory and
variables, trying to figure out why a certain Pattern match was not
firing, and noticed that a property value for a fact I inserted earlier
via the RHS does not seem to be inserted into working memory along with
the object. The fact's delegate (?) has the property value, but the fact
(as displayed in the variables tab) has a null value for the property.
Here is the rule that inserts the fact into memory:
rule "Explode Globals"
when
$request : DecisionRequest( )
$input : Object() from $request.getRequestObjects().values()
then
insert ( $input );
end
Just before the insert executes, $input looks like this in the variables
tab:
$input - NamedCollection<T> (id=61)
list - LinkedList<E> (id=62)
name - "constraints"
After the insert however, when the engine checks the name value in my
java class, the same fact now looks like this in the variables tab:
this - NamedCollectionShadowProxy (id=83)
delegate - NamedCollection<T> (id=61)
list - LinkedList<E> (id=62)
name - "constraints"
list - LinkedList<E> (id=87)
name - null << ??
So, when I next have a rule that looks like this:
rule "Assemble Constraints"
when
$const : OrderConstraint()
$coll : NamedCollection( name == "constraints" )
then
$coll.add($const);
update($coll);
end
Here is the java class:
public class NamedCollection<T> implements Collection<T>{
private static final long serialVersionUID = -457439174592908333L;
private Collection<T> list = new LinkedList<T>();
private String name;
public NamedCollection(){
}
public NamedCollection(String name){
this.name = name;
}
...more methods...
public String getName(){
return this.name;
}
public void setName(String name){
this.name = name;
}
}
The pattern does not match since the value for name is null! When I
place a breakpoint in my java code during drools debugging, the name
value will return null each time. I also have another rule that creates
a new OrderConstraint, so all conditions for the last rule to fire
exist...other than the name property being null although it is set in
the delegate. I do not have any other rules that modify the
NamedCollection.
What am I doing wrong? Is this again related to having a class implement
a collection?
HC
16 years, 11 months
Prefix 'and' and infix 'and' not interchangeable?
by Gattiker, Alexandre
The documentation on the 'and' Conditional Element seems to imply that these constructs are equivalent:
$p1:Entity($code1:code)
not (and
$p2:Entity(code == $code1)
eval(MyStaticClass.match($p1, $p2))
)
$p1:Entity($code1:code)
not (
$p2:Entity(code == $code1)
and eval(MyStaticClass.match($p1, $p2))
)
Actually, the first version crashes with this message:
unknown:93:7 Unexpected token 'and'[96,2]: unknown:96:2 mismatched token: [@792,3685:3685=')',<12>,96:2]; expecting type THEN
I'm on drools 4.0.2 and mvel14-1.2.8.
Alexandre
16 years, 11 months
Drools 4.0.4 Released
by Fernando Meyer
We just released Drools v4.0.4. This is a minor release with a few
improvements on existing features and some bug fixes.
Release Notes - JBoss Drools - Version 4.0.4
We would like to really thanks all the contributors that helped on getting
this release out. From those contributing patches and docs, to those testing
and reporting bugs and providing feedback. The list is a bit long to post
all names here and I may incur in a mistake forgetting someone, so our open
public thank you to you all!
Follows the release notes.
Happy Drooling
Drools Team
Release Notes - JBoss Drools - Version 4.0.4
Bug
* [JBRULES-1243] - Pattern matching does not allow spaces
* [JBRULES-1274] - NPE when using reserved word "action" as a bound
variable, or omitting rule title
* [JBRULES-1284] - ClassCastException when using "<" constraint on field
of type java.lang.Object containing data of type java.lang.Integer
* [JBRULES-1310] - java.lang.NullPointerException at
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(
JavaConsequenceBuilder.java:54)
* [JBRULES-1311] - NPE when compiling rule consequences
* [JBRULES-1313] - NullPointerException at JavaConsequenceBuilder.java:54
on RHS for simplest of consequences
* [JBRULES-1314] - Error parsing rule that is written in a single line
* [JBRULES-1316] - Serialising Both the RuleBase and WorkingMemory
throws null pointer
* [JBRULES-1317] - Rule Execution Very Slow on Subsequent Session Using
the Same Packages
* [JBRULES-1321] - org.drools.compiler.DroolsParserException: Unknown
error while parsing.
org.drools.compiler.DroolsParserException: Unknown error while
parsing.
* [JBRULES-1325] - OutOfMemory with the use of WorkingMemoryFileLogger
* [JBRULES-1336] - Typo in RuleBaseConfiguration(ClassLoader classLoder,
Properties properties) -- the ClassLoader specified in the constructor args
is not used
* [JBRULES-1337] - 'or' with predicate/return val/inline eval with
property issue
* [JBRULES-1339] - Debugging: Breakpoints are only considered for code
with variables
* [JBRULES-1340] - JBRMS - Admin - Manage Archived Assets - Open item
icon not opening item
* [JBRULES-1348] - Incorrect hash code calculation for character
attributes in alpha hashing optimization
* [JBRULES-1354] - Duplicate parameter error while trying to use pattern
bound variables or globals in accumulate function
* [JBRULES-1364] - Drl parser 'or'
* [JBRULES-1387] - Drools doesn't build with fresh maven2 installation
and no repository
* [JBRULES-1397] - org.mvel.CompileException: variable already defined
within scope
* [JBRULES-1410] - Rules with Collect / Accumulate CEs not working
correctly when dinamically added to a rulebase
* [JBRULES-1412] - ContextEntries should have cache nulled
* [JBRULES-1413] - KnowledgeHelper should have cache reset before use.
* [JBRULES-1416] - The use of HashKey is not thread safe in
CompositeObjectSinkAdapter
Feature Request
* [JBRULES-1308] - getFactHandle with equality-based assert behavior
* [JBRULES-1349] - NotNode and Exists Improvements
* [JBRULES-1375] - remove backported concurrency classes, now that we
are jdk1.5+
* [JBRULES-1395] - Add support to modify() block in java dialect
consequences
Patch
* [JBRULES-1323] - Add caching to the Objenesis instance and move
instance to the RuleBase level
Task
* [JBRULES-1421] - Update mvel version to 1.2.21 and update mvel
templates
--
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
fernando(a)fmeyer.org
16 years, 11 months