[jbpm-commits] JBoss JBPM SVN: r2649 - in jbpm3/trunk: modules/distribution/src/main/resources/database and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Oct 28 20:58:23 EDT 2008
Author: alex.guizar at jboss.com
Date: 2008-10-28 20:58:23 -0400 (Tue, 28 Oct 2008)
New Revision: 2649
Modified:
jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-hsqldb-ds.xml
jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-mysql-ds.xml
jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml
jbpm3/trunk/modules/enterprise/jar/pom.xml
jbpm3/trunk/modules/enterprise/jar/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java
jbpm3/trunk/pom.xml
Log:
[JBPM-1708] selective database exclusions for EjbSchedulerTest
mysql xa datasource
minor refinements to jms message service and test
Modified: jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-hsqldb-ds.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-hsqldb-ds.xml 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-hsqldb-ds.xml 2008-10-29 00:58:23 UTC (rev 2649)
@@ -1,29 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<datasources>
- <local-tx-datasource>
- <jndi-name>JbpmDS</jndi-name>
- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbpmDB</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
- <min-pool-size>1</min-pool-size>
- <max-pool-size>5</max-pool-size>
- <idle-timeout-minutes>0</idle-timeout-minutes>
- <track-statements/>
- <!--
- <security-domain>HsqlDbRealm</security-domain>
- -->
- <prepared-statement-cache-size>32</prepared-statement-cache-size>
- <metadata><type-mapping>Hypersonic SQL</type-mapping></metadata>
- <depends>jboss:service=Hypersonic,database=jbpmDB</depends>
- </local-tx-datasource>
+ <local-tx-datasource>
+ <jndi-name>JbpmDS</jndi-name>
- <mbean code="org.jboss.jdbc.HypersonicDatabase"
- name="jboss:service=Hypersonic,database=jbpmDB">
- <attribute name="Database">jbpmDB</attribute>
- <attribute name="InProcessMode">true</attribute>
- </mbean>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbpmDB</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ <!-- connection pool parameters -->
+ <min-pool-size>1</min-pool-size>
+ <max-pool-size>5</max-pool-size>
+
+ <!-- disable idle connection removal, hsqldb does not reap threads on closed connections -->
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+ <!-- check all statements are closed when the connection is returned to the pool -->
+ <track-statements />
+ <!-- hsqldb benefits from prepared statement caching -->
+ <prepared-statement-cache-size>32</prepared-statement-cache-size>
+
+ <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
+ <metadata>
+ <type-mapping>Hypersonic SQL</type-mapping>
+ </metadata>
+
+ <!-- ensure the datasource is not initialized before the database itself -->
+ <depends>jboss:service=Hypersonic,database=jbpmDB</depends>
+ </local-tx-datasource>
+
+ <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=jbpmDB">
+ <attribute name="Database">jbpmDB</attribute>
+ <attribute name="InProcessMode">true</attribute>
+ </mbean>
+
</datasources>
Modified: jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-mysql-ds.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-mysql-ds.xml 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-mysql-ds.xml 2008-10-29 00:58:23 UTC (rev 2649)
@@ -1,16 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
-<datasources>
- <local-tx-datasource>
+ <xa-datasource>
<jndi-name>JbpmDS</jndi-name>
- <connection-url>jdbc:mysql://localhost:3306/jbpmtest</connection-url>
- <driver-class>com.mysql.jdbc.Driver</driver-class>
+
+ <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
+ <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/jbpmtest</xa-datasource-property>
<user-name>jbpmtest</user-name>
<password></password>
- <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
- <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
+
+ <!-- reduce isolation from the default level (repeatable read) -->
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ <!-- separate connections used with and without JTA transaction -->
+ <no-tx-separate-pools />
+ <!-- disable transaction interleaving -->
+ <track-connection-by-tx />
+
+ <!-- leverage mysql integration features -->
+ <exception-sorter-class-name>
+ com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
+ </exception-sorter-class-name>
+ <valid-connection-checker-class-name>
+ com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
+ </valid-connection-checker-class-name>
+
+ <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
- </local-tx-datasource>
+ </xa-datasource>
+
</datasources>
\ No newline at end of file
Modified: jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml 2008-10-29 00:58:23 UTC (rev 2649)
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<datasources>
- <xa-datasource>
- <jndi-name>JbpmDS</jndi-name>
- <track-connection-by-tx />
+ <xa-datasource>
+ <jndi-name>JbpmDS</jndi-name>
- <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
- <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
- <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
+ <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
+ <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">jbpmtest</xa-datasource-property>
+ <xa-datasource-property name="User">jbpmtest</xa-datasource-property>
+ <xa-datasource-property name="Password"></xa-datasource-property>
- <xa-datasource-property name="DatabaseName">jbpmtest</xa-datasource-property>
- <xa-datasource-property name="User">jbpmtest</xa-datasource-property>
- <xa-datasource-property name="Password"></xa-datasource-property>
+ <!-- disable transaction interleaving -->
+ <track-connection-by-tx />
- <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>PostgreSQL 8.0</type-mapping>
- </metadata>
- </xa-datasource>
+ <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
+ <metadata>
+ <type-mapping>PostgreSQL 8.0</type-mapping>
+ </metadata>
+ </xa-datasource>
</datasources>
Modified: jbpm3/trunk/modules/enterprise/jar/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/pom.xml 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/enterprise/jar/pom.xml 2008-10-29 00:58:23 UTC (rev 2649)
@@ -174,6 +174,18 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${surefire.jvm.args}</argLine>
+ <systemProperties>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -228,11 +240,16 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: no-database
+ Descr: Setup the default database
+ -->
<profile>
- <id>no-xa-datasource</id>
+ <id>no-database</id>
<activation>
<property>
- <name>!datasource.xa</name>
+ <name>!database</name>
</property>
</activation>
<build>
@@ -241,7 +258,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <!-- do not remove, ejb scheduler requires xa support -->
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
<exclude>org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java</exclude>
</excludes>
</configuration>
@@ -249,20 +266,95 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: hsqldb
+ Descr: Hypersonic Database Setup
+ -->
<profile>
- <id>xa-datasource</id>
+ <id>hsqldb</id>
<activation>
<property>
- <name>datasource.xa</name>
+ <name>database</name>
+ <value>hsqldb</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
+ <exclude>org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
</plugins>
</build>
</profile>
+
+ <!--
+ Name: mysql
+ Descr: MySQL Database Setup
+ -->
+ <profile>
+ <id>mysql</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>mysql</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: postgresql
+ Descr: PostgreSQL Database Setup
+ -->
+ <profile>
+ <id>postgresql</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>postgresql</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: sybase
+ Descr: Sybase Database Setup
+ -->
+ <profile>
+ <id>sybase</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>sybase</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
Modified: jbpm3/trunk/modules/enterprise/jar/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/enterprise/jar/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java 2008-10-29 00:58:23 UTC (rev 2649)
@@ -60,22 +60,32 @@
public Object execute(JbpmContext jbpmContext) throws Exception {
JobSession jobSession = jbpmContext.getJobSession();
Job job = jobSession.getJob(jobId);
- if (job == null || job.getLockOwner() != null) {
- log.debug("job " + jobId + " was deleted or is locked, ignoring command");
+ if (job == null) {
+ log.debug("job " + jobId + " was deleted");
return null;
}
- String lockOwner = Long.toString(jobId);
+ String lockOwner = job.getLockOwner();
+ if (lockOwner != null) {
+ log.debug(job + " is locked by " + lockOwner);
+ return null;
+ }
+ lockOwner = Long.toString(jobId);
if (job.isExclusive()) {
List exclusiveJobs = jobSession.findExclusiveJobs(lockOwner, job.getProcessInstance());
// lock exclusive jobs
int jobCount = exclusiveJobs.size();
+ if (jobCount == 0) {
+ // may happen if isolation level is below repeatable read
+ log.debug(job + " was locked during attempt to lock other jobs");
+ return null;
+ }
long[] exclusiveJobIds = new long[jobCount];
for (int i = 0; i < jobCount; i++) {
Job exclusiveJob = (Job) exclusiveJobs.get(i);
exclusiveJob.setLockOwner(lockOwner);
exclusiveJobIds[i] = exclusiveJob.getId();
}
- log.debug("locked jobs " + Arrays.toString(exclusiveJobIds));
+ log.debug("locking jobs " + Arrays.toString(exclusiveJobIds));
// execute exclusive jobs in separate transaction
postJobsExecution(jbpmContext, exclusiveJobIds);
}
Modified: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java 2008-10-29 00:58:23 UTC (rev 2649)
@@ -76,8 +76,8 @@
protected void tearDown() throws Exception {
log.info("### " + getName() + " done ###");
+ commandService = null;
EventCallback.clear();
- commandService = null;
}
public void testAsyncNode() {
@@ -206,20 +206,20 @@
+ " </node>"
+ " <node name='b'>"
+ " <event type='node-enter'>"
- + " <action async='true' expression='#{eventCallback.nodeEnter}' />"
+ + " <action async='exclusive' expression='#{eventCallback.nodeEnter}' />"
+ " </event>"
+ " <transition to='c' />"
+ " </node>"
- + " <node name='c' async='true'>"
+ + " <node name='c' async='exclusive'>"
+ " <transition to='d' />"
+ " </node>"
+ " <node name='d'>"
+ " <event type='node-leave'>"
- + " <action async='true' expression='#{eventCallback.nodeLeave}' />"
+ + " <action async='exclusive' expression='#{eventCallback.nodeLeave}' />"
+ " </event>"
+ " <transition to='e' />"
+ " </node>"
- + " <node name='e' async='true'>"
+ + " <node name='e' async='exclusive'>"
+ " <transition to='end' />"
+ " </node>"
+ " <end-state name='end' />"
@@ -228,6 +228,8 @@
for (int i = 0; i < processExecutionCount; i++) {
processIds[i] = launchProcess("execution").getId();
EventCallback.waitForEvent(Event.EVENTTYPE_NODE_ENTER);
+ }
+ for (int i = 0; i < processExecutionCount; i++) {
EventCallback.waitForEvent(Event.EVENTTYPE_NODE_LEAVE);
}
for (int i = 0; i < processExecutionCount; i++) {
Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml 2008-10-28 17:26:15 UTC (rev 2648)
+++ jbpm3/trunk/pom.xml 2008-10-29 00:58:23 UTC (rev 2649)
@@ -78,7 +78,7 @@
<!-- Database Driver Versions -->
<hsqldb.version>1.8.0.7</hsqldb.version>
- <mysql.connector.version>5.1.6</mysql.connector.version>
+ <mysql.connector.version>5.0.8</mysql.connector.version>
<postgresql.version>8.3-603.jdbc3</postgresql.version>
</properties>
@@ -524,9 +524,6 @@
<value>postgresql</value>
</property>
</activation>
- <properties>
- <datasource.xa />
- </properties>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
@@ -548,9 +545,6 @@
<value>sybase</value>
</property>
</activation>
- <properties>
- <datasource.xa />
- </properties>
<dependencies>
<dependency>
<groupId>com.sybase</groupId>
More information about the jbpm-commits
mailing list