[jboss-svn-commits] JBL Code SVN: r26876 - in labs/jbossrules/branches/Branch_4_0_2_SOA_4_2: drools-core/src/main/java/org/drools/common and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jun 8 20:39:41 EDT 2009


Author: tirelli
Date: 2009-06-08 20:39:40 -0400 (Mon, 08 Jun 2009)
New Revision: 26876

Modified:
   labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
   labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
   labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
Log:
SOA-1286: backporting JBRULES-1876 into the SOA branch

Modified: labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	2009-06-08 14:02:24 UTC (rev 26875)
+++ labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	2009-06-09 00:39:40 UTC (rev 26876)
@@ -28,7 +28,6 @@
     private InstrumentedBuildContent context;
     private RuleBase ruleBase;
 
-    @Override
     protected void setUp() throws Exception {
         super.setUp();
         final Package pkg = new Package( "pkg1" );

Modified: labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java	2009-06-08 14:02:24 UTC (rev 26875)
+++ labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java	2009-06-09 00:39:40 UTC (rev 26876)
@@ -390,7 +390,7 @@
      * @throws FactException
      * @throws InvalidPatternException
      */
-    public synchronized void addPackage(final Package newPkg) throws PackageIntegrationException {
+    public void addPackage(final Package newPkg) throws PackageIntegrationException {
         newPkg.checkValidity();
         synchronized ( this.pkgs ) {
             final Package pkg = (Package) this.pkgs.get( newPkg.getName() );
@@ -532,16 +532,18 @@
         }
     }
 
-    private synchronized void addRule(final Package pkg,
+    private 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." );
+        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 );
         }
-        addRule( rule );
-        this.eventSupport.fireAfterRuleAdded( pkg,
-                                              rule );
     }
 
     protected abstract void addRule(final Rule rule) throws InvalidPatternException;
@@ -651,11 +653,14 @@
 
     private void removeRule(final Package pkg,
                             final Rule rule) {
-        this.eventSupport.fireBeforeRuleRemoved( pkg,
-                                                 rule );
-        removeRule( rule );
-        this.eventSupport.fireAfterRuleRemoved( pkg,
-                                                rule );
+        synchronized ( this.pkgs ) {
+            this.eventSupport.fireBeforeRuleRemoved( pkg,
+                                                     rule );
+            
+            removeRule( rule );
+            this.eventSupport.fireAfterRuleRemoved( pkg,
+                                                    rule );
+        }
     }
 
     protected abstract void removeRule(Rule rule);
@@ -686,7 +691,7 @@
         }
     }
 
-    public synchronized void addProcess(final Process process) {
+    public void addProcess(final Process process) {
         synchronized ( this.pkgs ) {
             this.processes.put( process.getId(),
                                 process );
@@ -694,7 +699,7 @@
 
     }
 
-    public synchronized void removeProcess(final String id) {
+    public void removeProcess(final String id) {
         synchronized ( this.pkgs ) {
             this.processes.remove( id );
         }
@@ -712,8 +717,10 @@
 		return objenesis;
 	}
 
-	protected synchronized void addStatefulSession(final StatefulSession statefulSession) {
-        this.statefulSessions.add( statefulSession );
+	protected void addStatefulSession(final StatefulSession statefulSession) {
+        synchronized ( this.statefulSessions ) {
+            this.statefulSessions.add( statefulSession );
+        }
     }
 
     public Package getPackage(final String name) {

Modified: labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
===================================================================
--- labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2009-06-08 14:02:24 UTC (rev 26875)
+++ labs/jbossrules/branches/Branch_4_0_2_SOA_4_2/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2009-06-09 00:39:40 UTC (rev 26876)
@@ -216,7 +216,7 @@
     /**
      * @see RuleBase
      */
-    public synchronized StatefulSession newStatefulSession(final boolean keepReference) {
+    public StatefulSession newStatefulSession(final boolean keepReference) {
         if ( this.config.isSequential() ) {
             throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
         }




More information about the jboss-svn-commits mailing list