[jboss-svn-commits] JBL Code SVN: r25485 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Mar 3 12:51:29 EST 2009
Author: mark.proctor at jboss.com
Date: 2009-03-03 12:51:29 -0500 (Tue, 03 Mar 2009)
New Revision: 25485
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
Log:
JBRULES-1876 Deadlock when RuleAgent thread refreshes rules while another thread creates a statefulSession
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2009-03-03 17:48:42 UTC (rev 25484)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2009-03-03 17:51:29 UTC (rev 25485)
@@ -438,7 +438,7 @@
* @param newPkg
* The package to add.
*/
- public synchronized void addPackages(final Collection<Package> newPkgs) {
+ public void addPackages(final Collection<Package> newPkgs) {
synchronized ( this.pkgs ) {
boolean doUnlock = false;
// only acquire the lock if it hasn't been done explicitely
@@ -621,16 +621,18 @@
return this.classTypeDeclaration.values();
}
- public synchronized void addRule(final Package pkg,
+ public void addRule(final Package pkg,
final Rule rule) throws InvalidPatternException {
- this.eventSupport.fireBeforeRuleAdded( pkg,
- rule );
-// if ( !rule.isValid() ) {
-// throw new IllegalArgumentException( "The rule called " + rule.getName() + " is not valid. Check for compile errors reported." );
-// }
- addRule( rule );
- this.eventSupport.fireAfterRuleAdded( pkg,
- rule );
+ synchronized ( this.pkgs ) {
+ this.eventSupport.fireBeforeRuleAdded( pkg,
+ rule );
+ // if ( !rule.isValid() ) {
+ // throw new IllegalArgumentException( "The rule called " + rule.getName() + " is not valid. Check for compile errors reported." );
+ // }
+ addRule( rule );
+ this.eventSupport.fireAfterRuleAdded( pkg,
+ rule );
+ }
}
protected abstract void addRule(final Rule rule) throws InvalidPatternException;
@@ -776,7 +778,7 @@
}
}
- public synchronized void addProcess(final Process process) {
+ public void addProcess(final Process process) {
synchronized ( this.pkgs ) {
this.processes.put( process.getId(),
process );
@@ -784,7 +786,7 @@
}
- public synchronized void removeProcess(final String id) {
+ public void removeProcess(final String id) {
synchronized ( this.pkgs ) {
this.processes.remove( id );
}
@@ -798,8 +800,10 @@
return process;
}
- public synchronized void addStatefulSession(final StatefulSession statefulSession) {
- this.statefulSessions.add( statefulSession );
+ public void addStatefulSession(final StatefulSession statefulSession) {
+ synchronized ( this.statefulSessions ) {
+ this.statefulSessions.add( statefulSession );
+ }
}
public Package getPackage(final String name) {
More information about the jboss-svn-commits
mailing list