[jboss-svn-commits] JBL Code SVN: r21504 - in labs/jbossesb/trunk/product: tools/console/management and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 13 03:14:19 EDT 2008
Author: tfennelly
Date: 2008-08-13 03:14:18 -0400 (Wed, 13 Aug 2008)
New Revision: 21504
Modified:
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
labs/jbossesb/trunk/product/tools/console/management/build.xml
Log:
Merges from the 4.4 CP branch
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-08-13 06:55:45 UTC (rev 21503)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-08-13 07:14:18 UTC (rev 21504)
@@ -460,30 +460,32 @@
boolean isRulesChanged = false;
final Map<String, String> ruleSets = lifecycleRuleSets.getLifecycleResource();
- if ( ruleReload )
- {
- String currentRuleSet = ruleSets.get( ruleSet );
- newRuleSet = rbHelper.getRulesAsString( ruleSet, dsl );
- if ( currentRuleSet == null || !currentRuleSet.equals(newRuleSet) )
- {
- isRulesChanged = true;
- }
- }
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
- RuleBase ruleBase = ruleBases.get( ruleSet );
- if ( ruleBase == null || isRulesChanged )
- {
- ruleBase = rbHelper.createRuleBaseFromRuleFiles(ruleSet, dsl);
- if (ruleBase != null)
- ruleBases.put(ruleSet, ruleBase);
- if (newRuleSet == null)
- newRuleSet = rbHelper.getRulesAsString(ruleSet, dsl);
- if (ruleSet != null)
- ruleSets.put(ruleSet, newRuleSet);
- }
- return ruleBase;
+ synchronized (ruleSets) {
+ if ( ruleReload )
+ {
+ String currentRuleSet = ruleSets.get( ruleSet );
+ newRuleSet = rbHelper.getRulesAsString( ruleSet, dsl );
+ if ( currentRuleSet == null || !currentRuleSet.equals(newRuleSet) )
+ {
+ isRulesChanged = true;
+ }
+ }
+ final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
+ RuleBase ruleBase = ruleBases.get( ruleSet );
+ if ( ruleBase == null || isRulesChanged )
+ {
+ ruleBase = rbHelper.createRuleBaseFromRuleFiles(ruleSet, dsl);
+ if (ruleBase != null)
+ ruleBases.put(ruleSet, ruleBase);
+ if (newRuleSet == null)
+ newRuleSet = rbHelper.getRulesAsString(ruleSet, dsl);
+ if (ruleSet != null)
+ ruleSets.put(ruleSet, newRuleSet);
+ }
+ return ruleBase;
+ }
}
catch (final LifecycleResourceException e)
{
@@ -525,14 +527,18 @@
final long startTime = System.nanoTime();
try
{
- RuleBase ruleBase = getCachedRuleBases().get( decisionTable );
- if ( ruleReload || ruleBase == null )
- {
- ruleBase = DroolsRuleBaseHelper.getInstance().createRuleBaseFromDecisionTable(decisionTable);
- getCachedRuleBases().put( decisionTable, ruleBase );
- }
- return ruleBase;
- }
+ Map<String, RuleBase> ruleBases = getCachedRuleBases();
+
+ synchronized (ruleBases) {
+ RuleBase ruleBase = ruleBases.get( decisionTable );
+ if ( ruleReload || ruleBase == null )
+ {
+ ruleBase = DroolsRuleBaseHelper.getInstance().createRuleBaseFromDecisionTable(decisionTable);
+ ruleBases.put( decisionTable, ruleBase );
+ }
+ return ruleBase;
+ }
+ }
catch (final IOException e)
{
updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
@@ -588,7 +594,7 @@
/**
* Execute rules using using the Stateful API
*
- * @param rulebase -
+ * @param rulebase -
* the rulebase to use
* @param dispose -
* if true the working memory will be dereferenced.
@@ -610,26 +616,25 @@
final Map<String,Object> globals,
final List<Object> objectList)
{
- final StatefulSession statefulSession = getStatefulSession( ruleBase );
- try
- {
- addGlobalsVariables( statefulSession, globals );
- final List<Object> facts = getFacts( message, objectList );
- insertObjectsIntoWorkingMemory( facts, statefulSession );
- statefulSession.fireAllRules();
- }
- finally
- {
- if ( dispose )
- {
- for ( StatefulSession session : ruleBase.getStatefulSessions())
- {
- session.dispose();
- }
- }
- }
+ synchronized (ruleBase) {
+ final StatefulSession statefulSession = getStatefulSession( ruleBase );
+ try
+ {
+ addGlobalsVariables( statefulSession, globals );
+ final List<Object> facts = getFacts( message, objectList );
+ insertObjectsIntoWorkingMemory( facts, statefulSession );
+ statefulSession.fireAllRules();
+ }
+ finally
+ {
+ if ( dispose )
+ {
+ statefulSession.dispose();
+ }
+ }
+ }
- return message;
+ return message;
}
private List<Object> getFacts(final Message message, final List<Object> objectList )
@@ -647,10 +652,12 @@
*/
private StatefulSession getStatefulSession( final RuleBase ruleBase )
{
- final StatefulSession[] statefulSessions = ruleBase.getStatefulSessions();
- boolean existingSession = statefulSessions != null && statefulSessions.length > 0;
- return existingSession ? statefulSessions[0] : ruleBase.newStatefulSession();
- }
+ synchronized (ruleBase) {
+ final StatefulSession[] statefulSessions = ruleBase.getStatefulSessions();
+ boolean existingSession = statefulSessions != null && statefulSessions.length > 0;
+ return existingSession ? statefulSessions[0] : ruleBase.newStatefulSession();
+ }
+ }
/*
* Will set the passed-in elements in the globals Map as global
@@ -661,9 +668,10 @@
if ( globals != null )
{
Set<Entry<String, Object>> entrySet = globals.entrySet();
- for ( Entry<String, Object> entry : entrySet )
+ for ( Entry<String, Object> entry : entrySet ) {
statelessSession.setGlobal( entry.getKey(), entry.getValue() );
- }
+ }
+ }
}
/*
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-08-13 06:55:45 UTC (rev 21503)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-08-13 07:14:18 UTC (rev 21504)
@@ -33,6 +33,7 @@
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.rules.RuleService;
+import org.apache.log4j.Logger;
/**
* RuleServiceCallHelper is a util class for calling
@@ -44,7 +45,10 @@
*/
public class RuleServiceCallHelper
{
- private RuleServiceCallHelper()
+
+ private static Logger logger = Logger.getLogger(RuleServiceCallHelper.class);
+
+ private RuleServiceCallHelper()
{
throw new AssertionError();
}
@@ -95,8 +99,15 @@
final String decisionTable = configTree.getAttribute( DECISION_TABLE.getTagName() );
final String ruleAgent = configTree.getAttribute( RULE_AGENT_PROPERTIES.getTagName() );
-
- final Boolean continueStateful = (Boolean) message.getProperties().getProperty( CONTINUE.getTagName(), Boolean.FALSE );
+
+ if(logger.isDebugEnabled()) {
+ final boolean isRuleReloadSpecified = (configTree.getAttribute(ListenerTagNames.RULE_RELOAD_TAG) != null);
+ if (ruleAgent != null && isRuleReloadSpecified) {
+ logger.debug("'" + ListenerTagNames.RULE_RELOAD_TAG + "' is specified on the same configuration as a Rule Agent configuration is specified. Ignoring the '" + ListenerTagNames.RULE_RELOAD_TAG + "' configuration.");
+ }
+ }
+
+ final Boolean continueStateful = (Boolean) message.getProperties().getProperty( CONTINUE.getTagName(), Boolean.FALSE );
if ( continueStateful )
{
// ruleSet can be a rule file, decisiontable or a ruleAgent properties file for continueStatefulRules
Modified: labs/jbossesb/trunk/product/tools/console/management/build.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management/build.xml 2008-08-13 06:55:45 UTC (rev 21503)
+++ labs/jbossesb/trunk/product/tools/console/management/build.xml 2008-08-13 07:14:18 UTC (rev 21504)
@@ -1,23 +1,26 @@
<?xml version="1.0"?>
<project name="jboss-esb-console" default="jar" basedir=".">
- <property name="esb.root.dir" location="../../.."/>
- <property name="console.dir" value="${esb.root.dir}/tools/console"/>
- <property file="${esb.root.dir}/tools/console/management-esb/db.properties"/>
- <property name="mgmt.dir" location="."/>
- <property name="mgmt.build.dir" location="${mgmt.dir}/build"/>
- <property name="src.java.dir" location="${mgmt.dir}/src/main/java"/>
+ <property name="esb.root.dir" location="../../.."/>
+ <property name="console.dir" value="${esb.root.dir}/tools/console"/>
+ <property file="${esb.root.dir}/tools/console/management-esb/db.properties"/>
+ <property name="mgmt.dir" location="."/>
+ <property name="mgmt.build.dir" location="${mgmt.dir}/build"/>
+ <property name="src.java.dir" location="${mgmt.dir}/src/main/java"/>
- <target name="clean">
- <delete dir="${mgmt.build.dir}"/>
- </target>
+ <target name="clean">
+ <delete dir="${mgmt.build.dir}"/>
+ </target>
<!-- Are we embedded in a source hierarchy? -->
<condition property="hierarchy.source">
- <available file="${esb.root.dir}/build-distr.xml"/>
+ <available file="${esb.root.dir}/build-distr.xml"/>
</condition>
<!-- Are we embedded in a jbossesb distribution hierarchy? -->
<condition property="hierarchy.jbossesb">
- <available file="${esb.root.dir}/JBossORG-EULA.txt"/>
+ <or>
+ <available file="${esb.root.dir}/JBossORG-EULA.txt"/>
+ <available file="${esb.root.dir}/JEMS-EULA.txt"/>
+ </or>
</condition>
<target name="dependencies" depends="dependencies.source, dependencies.jbossesb"/>
@@ -29,124 +32,114 @@
<fail unless="dist.exists"
message="JBossESB must be built. Please run 'ant dist' in ${esb.root.dir}"/>
- <property name="lib.dir" location="${mgmt.dir}/../../../build/lib"/>
+ <property name="lib.dir" location="${mgmt.dir}/../../../build/lib"/>
</target>
- <target name="define-lib">
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/lib/ext">
- <available type="dir" file="${esb.root.dir}/lib/ext"/>
- </condition>
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/server/default/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/default/deploy/jbossesb.sar/lib"/>
- </condition>
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib"/>
- </condition>
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib"/>
- </condition>
- <condition property="server.lib.dir"
- value="../../../server/default/lib">
- <available type="dir" file="../../../server/default/lib"
-/>
- </condition>
- <property name="server.lib.dir" value="${esb.lib.dir}"/>
- <path id="build.classpath">
- <fileset dir="${esb.root.dir}/tools/console/management-web/lib">
- <include name="*.jar"/>
- </fileset>
- <fileset dir="${server.lib.dir}">
- <include name="*.jar"/>
- </fileset>
- <fileset dir="${esb.lib.dir}">
- <include name="*.jar"/>
- </fileset>
- <fileset dir="${mgmt.dir}/lib">
- <include name="*.jar"/>
- </fileset>
- <fileset refid="lib"/>
- </path>
+ <target name="define-lib">
+ <condition property="esb.lib.dir"
+ value="${esb.root.dir}/lib/ext">
+ <available type="dir" file="${esb.root.dir}/lib/ext"/>
+ </condition>
+ <condition property="esb.lib.dir"
+ value="${esb.root.dir}/server/${org.jboss.esb.server.config}/deploy/jbossesb.sar/lib">
+ <available type="dir" file="${esb.root.dir}/server/${org.jboss.esb.server.config}/deploy/jbossesb.sar/lib"/>
+ </condition>
+ <condition property="server.lib.dir" value="../../../server/${org.jboss.esb.server.config}/lib">
+ <available type="dir" file="../../../server/${org.jboss.esb.server.config}/lib" />
+ </condition>
+ <property name="server.lib.dir" value="${esb.lib.dir}"/>
+ <path id="build.classpath">
+ <fileset dir="${esb.root.dir}/tools/console/management-web/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${server.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${esb.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${mgmt.dir}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset refid="lib"/>
+ </path>
- <condition property="lib.dir.path"
- value="${mgmt.dir}/../../../lib">
- <available type="dir" file="${mgmt.dir}/../../../lib"/>
- </condition>
+ <condition property="lib.dir.path"
+ value="${mgmt.dir}/../../../lib">
+ <available type="dir" file="${mgmt.dir}/../../../lib"/>
+ </condition>
- <condition property="lib.dir.path" value="${mgmt.dir}/./lib">
- <available type="dir" file="${mgmt.dir}/./lib"/>
- </condition>
+ <condition property="lib.dir.path" value="${mgmt.dir}/./lib">
+ <available type="dir" file="${mgmt.dir}/./lib"/>
+ </condition>
- <fileset id="lib" dir="${lib.dir}">
- <include name="*.jar" />
- </fileset>
+ <fileset id="lib" dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
- <condition property="rosetta.src" value="${esb.root.dir}/rosetta/src">
- <available type="dir" file="${esb.root.dir}/rosetta/src"/>
- </condition>
- <condition property="rosetta.src" value="${src.java.dir}">
- <available type="dir" file="${src.java.dir}"/>
- </condition>
- <property name="lib.dir" location="lib.dir.path"/>
- </target>
+ <condition property="rosetta.src" value="${esb.root.dir}/rosetta/src">
+ <available type="dir" file="${esb.root.dir}/rosetta/src"/>
+ </condition>
+ <condition property="rosetta.src" value="${src.java.dir}">
+ <available type="dir" file="${src.java.dir}"/>
+ </condition>
+ <property name="lib.dir" location="lib.dir.path"/>
+ </target>
- <target name="init" depends="dependencies, define-lib">
- <mkdir dir="${mgmt.build.dir}"/>
- <mkdir dir="${mgmt.build.dir}/classes"/>
- </target>
+ <target name="init" depends="dependencies, define-lib">
+ <mkdir dir="${mgmt.build.dir}"/>
+ <mkdir dir="${mgmt.build.dir}/classes"/>
+ </target>
- <target name="compile" depends="init"
- description="Build the management war">
- <echo>${esb.root.dir}</echo>
- <mkdir dir="${mgmt.build.dir}/classes"/>
- <javac classpathref="build.classpath"
- destdir="${mgmt.build.dir}/classes"
- debug="on"
- includes="org/jboss/soa/esb/monitoring/**"
- source="1.5"
- target="1.5"
- deprecation="${javac.deprecation}"
- nowarn="on">
- <src path="${rosetta.src}"/>
- <src path="${src.java.dir}"/>
- </javac>
- <copy file="${mgmt.dir}/src/main/resources/${db}/monitoring-mappings.hbm.xml"
- todir="build/classes/org/jboss/soa/esb/monitoring">
- </copy>
- </target>
+ <target name="compile" depends="init"
+ description="Build the management war">
+ <echo>${esb.root.dir}</echo>
+ <mkdir dir="${mgmt.build.dir}/classes"/>
+ <javac classpathref="build.classpath"
+ destdir="${mgmt.build.dir}/classes"
+ debug="on"
+ includes="org/jboss/soa/esb/monitoring/**"
+ source="1.5"
+ target="1.5"
+ deprecation="${javac.deprecation}"
+ nowarn="on">
+ <src path="${rosetta.src}"/>
+ <src path="${src.java.dir}"/>
+ </javac>
+ <copy file="${mgmt.dir}/src/main/resources/${db}/monitoring-mappings.hbm.xml"
+ todir="build/classes/org/jboss/soa/esb/monitoring">
+ </copy>
+ </target>
- <target name="jar" depends="compile"
- description="Build the distribution .jar file">
- <mkdir dir="${mgmt.dir}/build"/>
- <property file="${db}.properties"/>
- <echo>${db}</echo>
- <echo>${console.dir}</echo>
- <copy file="monitoring.cfg.xml" todir="${mgmt.build.dir}" overwrite="true">
- <filterset>
- <filter token="connection.datasource" value="${connection.datasource}"/>
- <filter token="db.dialect" value="${db.dialect}"/>
- </filterset>
- </copy>
- <jar jarfile="${mgmt.build.dir}/management-client.jar">
- <fileset dir="${mgmt.build.dir}/classes">
- <include name="org/jboss/soa/esb/monitoring/*.class"/>
- <include name="org/jboss/soa/esb/monitoring/pojo/*.class"/>
- <include name="org/jboss/soa/esb/monitoring/client/*.class"/>
- </fileset>
- </jar>
- <jar jarfile="${mgmt.build.dir}/management-server.jar">
- <fileset dir="${mgmt.build.dir}/classes">
- <include name="org/jboss/soa/esb/monitoring/*.class"/>
- <include name="org/jboss/soa/esb/monitoring/pojo/*.class"/>
- <include name="org/jboss/soa/esb/monitoring/server/*.class"/>
- <include name="**/*.xml"/>
- </fileset>
- <fileset dir="${mgmt.build.dir}">
- <include name="monitoring.cfg.xml"/>
- </fileset>
- </jar>
- </target>
+ <target name="jar" depends="compile"
+ description="Build the distribution .jar file">
+ <mkdir dir="${mgmt.dir}/build"/>
+ <property file="${db}.properties"/>
+ <echo>${db}</echo>
+ <echo>${console.dir}</echo>
+ <copy file="monitoring.cfg.xml" todir="${mgmt.build.dir}" overwrite="true">
+ <filterset>
+ <filter token="connection.datasource" value="${connection.datasource}"/>
+ <filter token="db.dialect" value="${db.dialect}"/>
+ </filterset>
+ </copy>
+ <jar jarfile="${mgmt.build.dir}/management-client.jar">
+ <fileset dir="${mgmt.build.dir}/classes">
+ <include name="org/jboss/soa/esb/monitoring/*.class"/>
+ <include name="org/jboss/soa/esb/monitoring/pojo/*.class"/>
+ <include name="org/jboss/soa/esb/monitoring/client/*.class"/>
+ </fileset>
+ </jar>
+ <jar jarfile="${mgmt.build.dir}/management-server.jar">
+ <fileset dir="${mgmt.build.dir}/classes">
+ <include name="org/jboss/soa/esb/monitoring/*.class"/>
+ <include name="org/jboss/soa/esb/monitoring/pojo/*.class"/>
+ <include name="org/jboss/soa/esb/monitoring/server/*.class"/>
+ <include name="**/*.xml"/>
+ </fileset>
+ <fileset dir="${mgmt.build.dir}">
+ <include name="monitoring.cfg.xml"/>
+ </fileset>
+ </jar>
+ </target>
</project>
More information about the jboss-svn-commits
mailing list