JBoss JBPM SVN: r6818 - in projects/jsf-console/branches/jsf-console-3.2-soa: console-tomcat and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-12 06:30:06 -0500 (Fri, 12 Nov 2010)
New Revision: 6818
Removed:
projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath
Modified:
projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.project
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project
Log:
remove unneeded eclipse files
Deleted: projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath 2010-11-12 11:27:36 UTC (rev 6817)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath 2010-11-12 11:30:06 UTC (rev 6818)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.project
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.project 2010-11-12 11:27:36 UTC (rev 6817)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.project 2010-11-12 11:30:06 UTC (rev 6818)
@@ -6,18 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
Deleted: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath 2010-11-12 11:27:36 UTC (rev 6817)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath 2010-11-12 11:30:06 UTC (rev 6818)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project 2010-11-12 11:27:36 UTC (rev 6817)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project 2010-11-12 11:30:06 UTC (rev 6818)
@@ -6,18 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
13 years, 7 months
JBoss JBPM SVN: r6817 - projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-12 06:27:36 -0500 (Fri, 12 Nov 2010)
New Revision: 6817
Added:
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-tomcat.xml
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/context.xml
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/web.xml
Log:
JBPM-2978 support tomcat as deployment target
Added: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-tomcat.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-tomcat.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-tomcat.xml 2010-11-12 11:27:36 UTC (rev 6817)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<AutomatedInstallation langpack="eng">
+ <com.izforge.izpack.panels.HelloPanel />
+ <com.izforge.izpack.panels.TargetPanel>
+ <installpath>@jbpm.home@</installpath>
+ </com.izforge.izpack.panels.TargetPanel>
+ <com.izforge.izpack.panels.TreePacksPanel>
+ <pack name="jBPM Standalone" index="0" selected="true" />
+ <pack name="Process Engine" index="1" selected="true" />
+ <pack name="Documentation" index="2" selected="true" />
+ <pack name="Eclipse Designer" index="3" selected="true" />
+ <pack name="JBoss AS Integration" index="4" selected="false" />
+ <pack name="jBPM Service" index="5" selected="false" />
+ <pack name="JSF Console" index="6" selected="false" />
+ <pack name="Tomcat Integration" index="7" selected="true" />
+ <pack name="Optional Downloads" index="8" selected="false" />
+ <pack name="JBoss AS" index="9" selected="false" />
+ <pack name="Eclipse" index="10" selected="false" />
+ </com.izforge.izpack.panels.TreePacksPanel>
+ <com.izforge.izpack.panels.UserInputPanel>
+ <userInput>
+ <entry key="jbossTargetServer" value="@jboss.server@" />
+ <entry key="jbossSelection" value="@container@" />
+ </userInput>
+ </com.izforge.izpack.panels.UserInputPanel>
+ <com.izforge.izpack.panels.UserInputPanel>
+ <userInput>
+ <entry key="jbossInstallPath" value="@jboss.home@" />
+ </userInput>
+ </com.izforge.izpack.panels.UserInputPanel>
+ <com.izforge.izpack.panels.UserInputPanel>
+ <userInput>
+ <entry key="tomcatInstallPath" value="@tomcat.home@" />
+ </userInput>
+ </com.izforge.izpack.panels.UserInputPanel>
+ <com.izforge.izpack.panels.UserInputPanel>
+ <userInput>
+ <entry key="dbSelection" value="@database@" />
+ </userInput>
+ </com.izforge.izpack.panels.UserInputPanel>
+ <com.izforge.izpack.panels.SummaryPanel />
+ <com.izforge.izpack.panels.InstallPanel />
+ <com.izforge.izpack.panels.FinishPanel />
+</AutomatedInstallation>
Property changes on: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-tomcat.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/context.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/context.xml (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/context.xml 2010-11-12 11:27:36 UTC (rev 6817)
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<Context>
+ <Resource name="jdbc/JbpmDataSource" auth="Container" type="javax.sql.DataSource"
+ driverClassName="org.hsqldb.jdbcDriver"
+ url="jdbc:hsqldb:${catalina.base}/work/Catalina/localhost/jbpm-console/jbpmDB"
+ username="sa" password="" />
+
+ <Realm className="org.jbpm.realm.DataSourceRealm" dataSourceName="jdbc/JbpmDataSource"
+ localDataSource="true"
+ userQuery="SELECT PASSWORD_
+ FROM JBPM_ID_USER
+ WHERE NAME_=?"
+ roleQuery="SELECT g.NAME_
+ FROM JBPM_ID_GROUP g
+ JOIN JBPM_ID_MEMBERSHIP m ON g.ID_ = m.GROUP_
+ JOIN JBPM_ID_USER u ON m.USER_ = u.ID_
+ WHERE g.TYPE_='security-role' AND u.NAME_=?" />
+</Context>
Property changes on: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/META-INF/context.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/web.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/web.xml 2010-11-12 11:27:36 UTC (rev 6817)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <servlet>
+ <description>Enable the JSF servlet. See faces-config.xml for Faces-specific configuration.</description>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Mapping for all plain pages -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <!-- This mapping is for the process images -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/app/pi/*</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <description>Use Documents Saved as *.xhtml</description>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <description>Facelets debug output</description>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <!-- A simple JSP to redirect to the basic search page -->
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!--
+ This role list should be changed to include all the relevant roles for your
+ environment.
+ -->
+ <security-role>
+ <role-name>admin</role-name>
+ </security-role>
+ <security-role>
+ <role-name>user</role-name>
+ </security-role>
+
+ <!--
+ Security constraints - optionally customize the role name to require a login
+ before access is allowed. Also, be sure to edit jboss-web.xml to configure
+ the security domain if you are deploying inside JBoss AS.
+ -->
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Secure Area</web-resource-name>
+ <url-pattern>/app/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>user</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <!-- Example Login page - lists sample users -->
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/ua/login-example.jsf</form-login-page>
+ <form-error-page>/ua/login-example.jsf?error=true</form-error-page>
+ </form-login-config>
+ </login-config>
+
+ <!-- Login configuration option #1 - use the login page ==>
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/ua/login.jsf</form-login-page>
+ <form-error-page>/ua/login.jsf?error=true</form-error-page>
+ </form-login-config>
+ </login-config>
+ <!== Login configuration option #1 -->
+
+ <!-- Login configuration option #2 - use basic auth ==>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>jBPM Administration Console</realm-name>
+ </login-config>
+ <!== Login configuration option #2 -->
+
+ <!-- Job executor launcher -->
+ <listener>
+ <description>
+ Starts the job executor on initialization and stops it on destruction.
+ </description>
+ <listener-class>org.jbpm.web.JobExecutorLauncher</listener-class>
+ </listener>
+ <!-- Job executor launcher -->
+
+ <listener>
+ <description>Closes the jBPM configuration on destruction, releasing resources.
+ This listener should appear after the job executor launcher,
+ to avoid reopening the configuration.</description>
+ <listener-class>org.jbpm.web.JbpmConfigurationCloser</listener-class>
+ </listener>
+
+ <resource-ref>
+ <description>Logical name of the data source that provides connections to the persistence service.
+ Must match the hibernate.connection.datasource property in the Hibernate
+ configuration file.</description>
+ <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+</web-app>
Property changes on: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/webapp/WEB-INF/web.xml
___________________________________________________________________
Name: svn:eol-style
+ native
13 years, 7 months
JBoss JBPM SVN: r6816 - in jbpm3/branches/jbpm-3.2-soa: core/src/main/java/org/jbpm and 17 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-12 06:11:07 -0500 (Fri, 12 Nov 2010)
New Revision: 6816
Added:
jbpm3/branches/jbpm-3.2-soa/tomcat/
jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath
jbpm3/branches/jbpm-3.2-soa/tomcat/.project
jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
jbpm3/branches/jbpm-3.2-soa/tomcat/src/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/
jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java
jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml
jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
Log:
JBPM-2978 support tomcat as deployment target
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -246,7 +246,7 @@
private final String resourceName;
private transient final ThreadLocal threadLocalContextStack = new ThreadLocalStack();
private JobExecutor jobExecutor;
- private boolean isClosed;
+ private volatile boolean isClosed;
static class ThreadLocalStack extends ThreadLocal {
protected Object initialValue() {
@@ -522,10 +522,10 @@
}
public void close(String jbpmContextName) {
+ // prevent configuration from being closed more than once
+ if (isClosed) return;
+
synchronized (this) {
- // prevent configuration from being closed more than once
- if (isClosed) return;
-
// stop job executor
if (jobExecutor != null) {
try {
@@ -568,11 +568,11 @@
// release thread-local context stack
threadLocalContextStack.set(null);
-
- // closing service factories requires open configuration
- isClosed = true;
}
+ // closing service factories requires open configuration
+ isClosed = true;
+
// remove from configuration cache
if (resourceName != null) {
synchronized (instances) {
@@ -591,7 +591,9 @@
}
static void clearInstances() {
- instances.clear();
+ synchronized (instances) {
+ instances.clear();
+ }
}
public JbpmContext getCurrentJbpmContext() {
@@ -658,11 +660,13 @@
getJobExecutor().start();
}
- public synchronized JobExecutor getJobExecutor() {
+ public JobExecutor getJobExecutor() {
ensureOpen();
- if (jobExecutor == null) {
- jobExecutor = (JobExecutor) objectFactory.createObject("jbpm.job.executor");
+ synchronized (this) {
+ if (jobExecutor == null) {
+ jobExecutor = (JobExecutor) objectFactory.createObject("jbpm.job.executor");
+ }
}
return jobExecutor;
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -142,12 +142,10 @@
if (isClosed) return;
RuntimeException saveException = autoSave();
- if (saveException != null) {
- closeServices();
- throw saveException;
- }
-
RuntimeException serviceException = closeServices();
+ isClosed = true;
+
+ if (saveException != null) throw saveException;
if (serviceException != null) throw serviceException;
}
@@ -169,15 +167,14 @@
private RuntimeException closeServices() {
try {
services.close();
+ return null;
}
catch (RuntimeException e) {
return e;
}
finally {
- isClosed = true;
jbpmConfiguration.popJbpmContext(this);
}
- return null;
}
/**
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -34,83 +34,55 @@
import org.jbpm.JbpmConfiguration;
/**
- * starts the job executor on init and closes the
- * jbpm configuration upon destroy. The closing of the
- * jbpm configuration will also shut down the job executor
- * thread pool.
- * <h1>Config parameters</h1>
+ * <p>
+ * Starts the job executor on initialization and closes the jBPM configuration on destruction.
+ * Closing the jBPM configuration also stops the job executor.
+ * </p>
+ * <h3>Servlet context parameters</h3>
* <table border="1">
- * <tr>
- * <th>Name</th>
- * <th>Description</th>
- * <th>Type</th>
- * <th>Default value</th>
- * </tr>
- * <tr>
- * <td>jbpm.configuration.resource</td>
- * <td>resource location of the jbpm.cfg.xml</td>
- * <td>String</td>
- * <td>jbpm.cfg.xml</td>
- * </tr>
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default value</th>
+ * </tr>
+ * <tr>
+ * <td>jbpm.configuration.resource</td>
+ * <td>classpath resource containing the jBPM configuration</td>
+ * <td>jbpm.cfg.xml</td>
+ * </tr>
* </table>
*
- * <p>Configuration example:
- * <pre>
- * <web-app>
- * ...
- * <servlet >
- * <servlet-name>JobExecutorServlet</servlet-name>
- * <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
- * <load-on-startup>1</load-on-startup>
- * </servlet>
- * <servlet-mapping >
- * <servlet-name>JobExecutorServlet</servlet-name>
- * <url-pattern>/jobexecutor</url-pattern>
- * </servlet-mapping>
- * ...
- * </web-app>
- * </pre>
- * </p>
* @deprecated Replaced by {@link org.jbpm.web.JobExecutorLauncher}
*/
public class JobExecutorServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
-
- JbpmConfiguration jbpmConfiguration;
-
+
+ private JbpmConfiguration jbpmConfiguration;
+
public void init() throws ServletException {
- String configurationName = getInitParameter("jbpm.configuration.resource", null);
+ String configurationName = getServletContext().getInitParameter("jbpm.configuration.resource");
jbpmConfiguration = JbpmConfiguration.getInstance(configurationName);
jbpmConfiguration.startJobExecutor();
}
-
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<html>");
+ out.println("<head><title>jBPM Job Executor</title></head>");
out.println("<body>");
- out.println("<h2>JBoss jBPM Scheduler Servlet</h2><hr />");
+ out.println("<h3>jBPM Job Executor</h3><hr />");
Collection threads = jbpmConfiguration.getJobExecutor().getThreads().values();
- Iterator iter = threads.iterator();
- while (iter.hasNext()) {
+ for (Iterator iter = threads.iterator(); iter.hasNext();) {
Thread thread = (Thread) iter.next();
- out.println("<h4>"+thread.getName()+"</h4>");
- out.println("<b>isAlive</b>:"+thread.isAlive());
+ out.println("<p>" + thread.getName() + "</p>");
}
out.println("</body>");
out.println("</html>");
}
- String getInitParameter(String name, String defaultValue) {
- String value = getInitParameter(name);
- if (value!=null) {
- return value;
- }
- return defaultValue;
- }
-
- public void destroy() {
- super.destroy();
+ public void destroy() {
jbpmConfiguration.close();
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -6,44 +6,37 @@
import org.jbpm.JbpmConfiguration;
/**
- * Closes the jBPM configuration on servlet context destruction.
- * <h1>Config parameters</h1>
+ * <p>
+ * Closes the jBPM configuration on destruction.
+ * </p>
+ * <h3>Servlet context parameters</h3>
* <table border="1">
- * <tr>
- * <th>Name</th>
- * <th>Description</th>
- * <th>Type</th>
- * <th>Default value</th>
- * </tr>
- * <tr>
- * <td>jbpm.configuration.resource</td>
- * <td>resource location of the jbpm.cfg.xml</td>
- * <td>String</td>
- * <td>jbpm.cfg.xml</td>
- * </tr>
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default value</th>
+ * </tr>
+ * <tr>
+ * <td>jbpm.configuration.resource</td>
+ * <td>classpath resource containing the jBPM configuration</td>
+ * <td>jbpm.cfg.xml</td>
+ * </tr>
* </table>
+ *
* @deprecated Replaced by {@link org.jbpm.web.JbpmConfigurationCloser}
*/
public class CloseJbpmConfigurationServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- String configurationName;
-
+ private String configurationName;
+
public void init() throws ServletException {
- configurationName = getInitParameter("jbpm.configuration.resource", null);
+ configurationName = getServletContext().getInitParameter("jbpm.configuration.resource");
}
-
+
public void destroy() {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(configurationName);
jbpmConfiguration.close();
}
-
- String getInitParameter(String name, String defaultValue) {
- String value = getInitParameter(name);
- if (value!=null) {
- return value;
- }
- return defaultValue;
- }
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -30,7 +30,7 @@
* <p>
* Closes the jBPM configuration on servlet context destruction.
* </p>
- * <h3>Configuration</h3> Servlet context initialization parameters
+ * <h3>Servlet context parameters</h3>
* <table border="1">
* <tr>
* <th>Name</th>
@@ -39,7 +39,7 @@
* </tr>
* <tr>
* <td>jbpm.configuration.resource</td>
- * <td>name of classpath resource containing the configuration</td>
+ * <td>classpath resource containing the jBPM configuration</td>
* <td>jbpm.cfg.xml</td>
* </tr>
* </table>
@@ -51,8 +51,7 @@
private JbpmConfiguration jbpmConfiguration;
public void contextInitialized(ServletContextEvent event) {
- String resource = event.getServletContext()
- .getInitParameter("jbpm.configuration.resource");
+ String resource = event.getServletContext().getInitParameter("jbpm.configuration.resource");
jbpmConfiguration = JbpmConfiguration.getInstance(resource);
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -38,56 +38,50 @@
public class JbpmContextFilter implements Filter, Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- String jbpmConfigurationResource = null;
- String jbpmContextName = null;
- boolean isAuthenticationEnabled = true;
+ private JbpmConfiguration jbpmConfiguration;
+ private String jbpmContextName;
+ private boolean isAuthenticationEnabled = true;
public void init(FilterConfig filterConfig) throws ServletException {
// get the jbpm configuration resource
- this.jbpmConfigurationResource = filterConfig.getInitParameter("jbpm.configuration.resource");
-
+ String resource = filterConfig.getServletContext()
+ .getInitParameter("jbpm.configuration.resource");
+ jbpmConfiguration = JbpmConfiguration.getInstance(resource);
+
// get the jbpm context to be used from the jbpm configuration
- this.jbpmContextName = filterConfig.getInitParameter("jbpm.context.name");
- if (jbpmContextName==null) {
+ jbpmContextName = filterConfig.getInitParameter("jbpm.context.name");
+ if (jbpmContextName == null) {
jbpmContextName = JbpmContext.DEFAULT_JBPM_CONTEXT_NAME;
}
-
+
// see if authentication is turned off
String isAuthenticationEnabledText = filterConfig.getInitParameter("authentication");
- if ( (isAuthenticationEnabledText!=null)
- && ("disabled".equalsIgnoreCase(isAuthenticationEnabledText))
- ) {
+ if (isAuthenticationEnabledText != null
+ && "disabled".equalsIgnoreCase(isAuthenticationEnabledText)) {
isAuthenticationEnabled = false;
}
}
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
- String actorId = null;
-
- // see if we can get the authenticated swimlaneActorId
- if (servletRequest instanceof HttpServletRequest) {
- HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
- Principal userPrincipal = httpServletRequest.getUserPrincipal();
- if (userPrincipal != null) {
- actorId = userPrincipal.getName();
- }
- }
-
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
+ FilterChain filterChain) throws IOException, ServletException {
JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext(jbpmContextName);
try {
- if (isAuthenticationEnabled) {
- jbpmContext.setActorId(actorId);
+ if (isAuthenticationEnabled && servletRequest instanceof HttpServletRequest) {
+ HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+ Principal userPrincipal = httpServletRequest.getUserPrincipal();
+ if (userPrincipal != null) jbpmContext.setActorId(userPrincipal.getName());
}
filterChain.doFilter(servletRequest, servletResponse);
- } finally {
+ }
+ finally {
jbpmContext.close();
}
}
protected JbpmConfiguration getJbpmConfiguration() {
- return JbpmConfiguration.getInstance(jbpmConfigurationResource);
+ return jbpmConfiguration;
}
public void destroy() {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -28,10 +28,10 @@
import org.jbpm.job.executor.JobExecutor;
/**
- * Starts the job executor on servlet context initialization and stops it on servlet context
- * destruction.
- * <h3>Configuration</h3>
- * Servlet context initialization parameters
+ * <p>
+ * Starts the job executor on initialization and stops it on destruction.
+ * </p>
+ * <h3>Servlet context parameters</h3>
* <table border="1">
* <tr>
* <th>Name</th>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -97,6 +97,11 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-tomcat</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-userguide</artifactId>
<version>${project.version}</version>
<type>jdocbook</type>
@@ -113,6 +118,11 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jsf-console-tomcat</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
<artifactId>gpd-deployer</artifactId>
<type>war</type>
</dependency>
@@ -247,6 +257,7 @@
<property name="container" value="${container}" />
<property name="jboss.home" value="${jboss.home}" />
<property name="jboss.server" value="${jboss.server}" />
+ <property name="tomcat.home" value="${tomcat.home}" />
<property name="database" value="${database}" />
<ant antfile="scripts/antrun-installer.xml" target="process-resources" />
</tasks>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -98,6 +98,11 @@
<macro-enable file="${hsqldb.cfg.xml}" section="DataSource properties" />
<macro-enable file="${hsqldb.cfg.xml}" section="JTA transaction properties" />
+ <property name="tomcat.cfg.xml"
+ value="${project.build.assembly.dir}/config/hibernate.cfg.tomcat.xml" />
+ <copy file="${hsqldb.cfg.xml}" tofile="${tomcat.cfg.xml}" />
+ <macro-disable file="${tomcat.cfg.xml}" section="JTA transaction properties" />
+
<edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.db2.xml"/>
<edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.mssql.xml"/>
<edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.mysql.xml"/>
@@ -120,6 +125,7 @@
<filter token="container" value="${container}" />
<filter token="jboss.home" value="${jboss.home}" />
<filter token="jboss.server" value="${jboss.server}"/>
+ <filter token="tomcat.home" value="${tomcat.home}" />
<filter token="database" value="${database}" />
</filterset>
</copy>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -13,9 +13,10 @@
<pack name="JBoss AS Integration" index="4" selected="true" />
<pack name="jBPM Service" index="5" selected="true" />
<pack name="JSF Console" index="6" selected="true" />
- <pack name="Optional Downloads" index="7" selected="false" />
- <pack name="JBoss AS" index="8" selected="false" />
- <pack name="Eclipse" index="9" selected="false" />
+ <pack name="Tomcat Integration" index="7" selected="false" />
+ <pack name="Optional Downloads" index="8" selected="false" />
+ <pack name="JBoss AS" index="9" selected="false" />
+ <pack name="Eclipse" index="10" selected="false" />
</com.izforge.izpack.panels.TreePacksPanel>
<com.izforge.izpack.panels.UserInputPanel>
<userInput>
@@ -25,14 +26,19 @@
</com.izforge.izpack.panels.UserInputPanel>
<com.izforge.izpack.panels.UserInputPanel>
<userInput>
- <entry key="dbSelection" value="@database@" />
+ <entry key="jbossInstallPath" value="@jboss.home@" />
</userInput>
</com.izforge.izpack.panels.UserInputPanel>
<com.izforge.izpack.panels.UserInputPanel>
<userInput>
- <entry key="jbossInstallPath" value="@jboss.home@" />
+ <entry key="tomcatInstallPath" value="@tomcat.home@" />
</userInput>
</com.izforge.izpack.panels.UserInputPanel>
+ <com.izforge.izpack.panels.UserInputPanel>
+ <userInput>
+ <entry key="dbSelection" value="@database@" />
+ </userInput>
+ </com.izforge.izpack.panels.UserInputPanel>
<com.izforge.izpack.panels.SummaryPanel />
<com.izforge.izpack.panels.InstallPanel />
<com.izforge.izpack.panels.FinishPanel />
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -40,6 +40,7 @@
<variable name="jboss423.home" value="@{jboss423.home}" />
<variable name="jboss501.home" value="@{jboss501.home}" />
<variable name="jboss510.home" value="@{jboss510.home}" />
+ <variable name="tomcat.home" value="@{tomcat.home}" />
</variables>
<!-- Dynamic Variables -->
@@ -109,6 +110,7 @@
<panel classname="UserInputPanel" />
<panel classname="UserInputPanel" />
<panel classname="UserInputPanel" />
+ <panel classname="UserInputPanel" />
<panel classname="SummaryPanel" />
<panel classname="InstallPanel" />
<panel classname="FinishPanel" />
@@ -210,7 +212,7 @@
<pack name="jBPM Service" parent="JBoss AS Integration" required="no" preselected="no">
<description>Business process management service</description>
- <!-- jbpm/jbpm-service.sar -->
+ <!-- jbpm-service.sar -->
<file src="@{assemblyDirectory}/lib/jbpm-enterprise-config.jar"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
unpack="true" condition="isJBoss405" />
@@ -236,14 +238,8 @@
<file condition="isJBoss423"
src="@{assemblyDirectory}/lib/hibernate-jbc-cacheprovider.jar"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
- <file condition="isJBoss501"
- src="@{assemblyDirectory}/lib/commons-lang.jar"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
- <file condition="isJBoss510"
- src="@{assemblyDirectory}/lib/commons-lang.jar"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
- <!-- jbpm/jbpm-enterprise.jar -->
+ <!-- jbpm-enterprise.jar -->
<file src="@{assemblyDirectory}/lib/jbpm-enterprise.jar"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
unpack="true" condition="isJBoss405" />
@@ -373,7 +369,7 @@
<pack name="JSF Console" parent="JBoss AS Integration" required="no" preselected="no">
<description>Web console based on the Java Server Faces technology</description>
- <!-- jbpm/jsf-console.war -->
+ <!-- jsf-console.war -->
<file src="@{assemblyDirectory}/lib/jsf-console.war"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
unpack="true" condition="isJBoss405" />
@@ -387,7 +383,7 @@
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
unpack="true" condition="isJBoss510" />
- <!-- jbpm/gpd-deployer.war -->
+ <!-- gpd-deployer.war -->
<file src="@{assemblyDirectory}/lib/gpd-deployer.war"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/gpd-deployer.war"
unpack="true" />
@@ -395,6 +391,50 @@
<!--
********************************
+ * Tomcat Integration *
+ ********************************
+ -->
+ <pack name="Tomcat Integration" required="no" preselected="no">
+ <description>Web server integration</description>
+
+ <!-- lib -->
+ <file src="@{assemblyDirectory}/lib/jbpm-tomcat.jar"
+ targetdir="${tomcatInstallPath}/lib" />
+ <file src="@{assemblyDirectory}/lib/hsqldb.jar" targetdir="${tomcatInstallPath}/lib" />
+
+ <!-- webapps/jbpm-console -->
+ <file src="@{assemblyDirectory}/lib/jsf-console-tomcat.war"
+ targetdir="${tomcatInstallPath}/webapps/jbpm-console"
+ unpack="true" />
+ <fileset dir="@{assemblyDirectory}/lib"
+ targetdir="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/lib">
+ <include name="antlr.jar" />
+ <include name="asm.jar" />
+ <include name="backport-util-concurrent.jar" />
+ <include name="bsh.jar" />
+ <include name="cglib.jar" />
+ <include name="commons-collections.jar" />
+ <include name="commons-logging.jar" />
+ <include name="dom4j.jar" />
+ <include name="hibernate.jar" />
+ <include name="jbpm-jpdl.jar" />
+ <include name="jbpm-identity.jar" />
+ <include name="jta.jar" />
+ </fileset>
+ <file src="@{assemblyDirectory}/config/jbpm.cfg.xml"
+ targetdir="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/classes" />
+ <singlefile src="@{assemblyDirectory}/config/hibernate.cfg.tomcat.xml"
+ target="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/classes/hibernate.cfg.xml" />
+
+ <!-- work/jbpm-console -->
+ <fileset dir="@{resourcesDirectory}/database/hypersonic"
+ targetdir="${tomcatInstallPath}/work/Catalina/localhost/jbpm-console">
+ <include name="jbpmDB.*" />
+ </fileset>
+ </pack>
+
+ <!--
+ ********************************
* Optional Downloads *
********************************
-->
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -2,6 +2,7 @@
<langpack>
<str id="jboss.selection" txt="JBoss AS version" />
<str id="jboss.configuration" txt="Server configuration" />
- <str id="jboss.home" txt="JBoss AS home" />
+ <str id="jboss.home" txt="JBoss AS directory" />
+ <str id="tomcat.home" txt="Tomcat directory" />
<str id="database.selection" txt="Database" />
</langpack>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -2,6 +2,7 @@
<langpack>
<str id="jboss.selection" txt="Versión de JBoss AS" />
<str id="jboss.configuration" txt="Configuración del servidor" />
- <str id="jboss.home" txt="Ruta de JBoss AS" />
+ <str id="jboss.home" txt="Directorio de JBoss AS" />
+ <str id="tomcat.home" txt="Directorio de Tomcat" />
<str id="database.selection" txt="Base de datos" />
</langpack>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -23,6 +23,12 @@
</field>
</panel>
<panel order="2">
+ <createForPack name="Tomcat Integration" />
+ <field type="dir" align="left" variable="tomcatInstallPath">
+ <spec id="tomcat.home" size="20" set="${tomcat.home}" />
+ </field>
+ </panel>
+ <panel order="3">
<createForPack name="JBoss AS Integration" />
<field type="radio" variable="dbSelection">
<description align="left" id="database.selection" />
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -19,7 +19,6 @@
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
<version>3.2.10-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
</parent>
<build>
@@ -92,7 +91,7 @@
<activeByDefault>true</activeByDefault>
</activation>
<build>
- <finalName>${project.artifactId}-${project.version}-soa4x.jar</finalName>
+ <finalName>${project.artifactId}-${project.version}-soa4x</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -107,12 +106,12 @@
<profile>
<id>soa5x</id>
<build>
- <finalName>${project.artifactId}-${project.version}-soa5x.jar</finalName>
+ <finalName>${project.artifactId}-${project.version}-soa5x</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
- <exclude>*soa5x*</exclude>
+ <exclude>*soa4x*</exclude>
</excludes>
</resource>
</resources>
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -72,6 +72,12 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jsf-console-tomcat</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
<artifactId>gpd-deployer</artifactId>
<version>${project.version}</version>
<type>war</type>
@@ -190,12 +196,6 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.4.sp1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.cluster</groupId>
@@ -596,6 +596,7 @@
<jdk>[1.5,1.7)</jdk>
</activation>
<modules>
+ <module>tomcat</module>
<module>enterprise-jee5</module>
</modules>
</profile>
Modified: jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/profiles.example.xml 2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/profiles.example.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -63,6 +63,7 @@
<jboss510.home>$USER_HOME/jboss-5.1.0.GA</jboss510.home>
<jboss.server>all</jboss.server>
+ <tomcat.home>$USER_HOME/apache-tomcat-6.0.29</tomcat.home>
<jbpm.home>$USER_HOME/jbpm-${project.version}</jbpm.home>
</properties>
</profile>
Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat
___________________________________________________________________
Name: svn:ignore
+ .settings
target
Added: jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath 2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: jbpm3/branches/jbpm-3.2-soa/tomcat/.project
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/.project (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/.project 2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>tomcat</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,42 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>jBPM3 - Tomcat</name>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-tomcat</artifactId>
+
+ <parent>
+ <artifactId>jbpm</artifactId>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <version>3.2.10-SNAPSHOT</version>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- Provided dependencies -->
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.29</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java 2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,270 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.realm;
+
+import java.security.Principal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.realm.GenericPrincipal;
+import org.apache.catalina.realm.RealmBase;
+import org.apache.naming.ContextBindings;
+
+/**
+ * Realm implementation that works with any JDBC data source. Unlike the standard
+ * {@link org.apache.catalina.realm.DataSourceRealm DataSourceRealm} provided by Tomcat, this
+ * implementation allows for a wider variety of database schemas by externalizing the queries
+ * used to retrieve users and roles.
+ *
+ * @see <a href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html">Realm How-To</a>
+ * @author Alejandro Guizar
+ */
+public class DataSourceRealm extends RealmBase {
+
+ /** The JNDI name of the data source */
+ private String dataSourceName;
+
+ /** Context-local datasource. */
+ private boolean localDataSource;
+
+ /** SQL query for retrieving the password associated to a user name. */
+ private String userQuery;
+
+ /** SQL query for retrieving the roles associated to a user name. */
+ private String roleQuery;
+
+ /**
+ * Return the JNDI name of the data source.
+ */
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+
+ /**
+ * Set the JNDI name of the data source.
+ *
+ * @param dataSourceName the JNDI name of the data source.
+ */
+ public void setDataSourceName(String dataSourceName) {
+ this.dataSourceName = dataSourceName;
+ }
+
+ /**
+ * Tells whether the realm uses a data source defined for the enclosing Context rather than a
+ * global data source.
+ */
+ public boolean getLocalDataSource() {
+ return localDataSource;
+ }
+
+ /**
+ * Sets whether the realm uses a data source defined for the enclosing Context rather than a
+ * global data source.
+ *
+ * @param localDataSource the new flag value
+ */
+ public void setLocalDataSource(boolean localDataSource) {
+ this.localDataSource = localDataSource;
+ }
+
+ /** Returns the SQL query for retrieving the password associated to a user name. */
+ public String getUserQuery() {
+ return userQuery;
+ }
+
+ /**
+ * Sets the the SQL query for retrieving the password associated to a user name. The query
+ * must
+ *
+ * @param userQuery
+ */
+ public void setUserQuery(String userQuery) {
+ this.userQuery = userQuery;
+ }
+
+ /** Returns the SQL query for retrieving the roles associated to a user name. */
+ public String getRoleQuery() {
+ return roleQuery;
+ }
+
+ /**
+ * Sets the SQL query for retrieving the roles associated to a user name.
+ *
+ * @param rolesQuery
+ */
+ public void setRoleQuery(String rolesQuery) {
+ this.roleQuery = rolesQuery;
+ }
+
+ protected String getName() {
+ return "JbpmConsoleRealm";
+ }
+
+ protected String getPassword(String username) {
+ // Ensure that we have an open database connection
+ Connection dbConnection = open();
+ if (dbConnection != null) {
+ try {
+ return getPassword(dbConnection, username);
+ }
+ finally {
+ close(dbConnection);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the password associated with the given principal's user name.
+ *
+ * @param dbConnection The database connection to be used
+ * @param username user for which password should be retrieved
+ */
+ private String getPassword(Connection dbConnection, String username) {
+ PreparedStatement statement = null;
+ try {
+ statement = dbConnection.prepareStatement(userQuery);
+ statement.setString(1, username);
+
+ ResultSet resultSet = statement.executeQuery();
+ if (resultSet.next()) return resultSet.getString(1);
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.getPassword.exception", username));
+ }
+ finally {
+ if (statement != null) {
+ try {
+ // When a Statement is closed, its current ResultSet, if one exists, is also closed
+ statement.close();
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.getPassword.exception", username));
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Principal getPrincipal(String username) {
+ Connection dbConnection = open();
+ if (dbConnection != null) {
+ try {
+ return (new GenericPrincipal(this,
+ username,
+ getPassword(dbConnection, username),
+ getRoles(dbConnection, username)));
+ }
+ finally {
+ close(dbConnection);
+ }
+ }
+ return new GenericPrincipal(this, username, null, null);
+ }
+
+ private List<String> getRoles(Connection dbConnection, String username) {
+ PreparedStatement statement = null;
+ try {
+ statement = dbConnection.prepareStatement(roleQuery);
+ statement.setString(1, username);
+
+ ResultSet rs = statement.executeQuery();
+ List<String> roles = new ArrayList<String>();
+ while (rs.next()) {
+ roles.add(rs.getString(1));
+ }
+ return roles;
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.getRoles.exception", username));
+ return null;
+ }
+ finally {
+ if (statement != null) {
+ try {
+ // When a Statement is closed, its current ResultSet, if one exists, is also closed
+ statement.close();
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.getRoles.exception", username));
+ }
+ }
+ }
+ }
+
+ private Connection open() {
+ try {
+ Context context;
+ if (localDataSource) {
+ context = (Context) ContextBindings.getClassLoader().lookup("comp/env");
+ }
+ else {
+ StandardServer server = (StandardServer) ServerFactory.getServer();
+ context = server.getGlobalNamingContext();
+ }
+ DataSource dataSource = (DataSource) context.lookup(dataSourceName);
+ return dataSource.getConnection();
+ }
+ catch (NamingException e) {
+ containerLog.error(sm.getString("dataSourceRealm.exception"), e);
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.exception"), e);
+ }
+ return null;
+ }
+
+ /**
+ * Close the specified database connection.
+ *
+ * @param dbConnection The connection to be closed
+ */
+ private void close(Connection dbConnection) {
+ // Commit if not auto committed
+ try {
+ if (!dbConnection.getAutoCommit()) {
+ dbConnection.commit();
+ }
+ }
+ catch (SQLException e) {
+ containerLog.error("Exception committing connection before closing:", e);
+ }
+
+ // Close this database connection, and log any errors
+ try {
+ dbConnection.close();
+ }
+ catch (SQLException e) {
+ containerLog.error(sm.getString("dataSourceRealm.close"), e); // Just log it here
+ }
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml 2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<mbeans-descriptors>
+ <mbean name="JbpmDataSourceRealm" className="org.apache.catalina.mbeans.ClassNameMBean"
+ description="Realm implementation that works with any JDBC data source" domain="Catalina"
+ group="Realm" type="org.jbpm.realm.DataSourceRealm">
+
+ <attribute name="className" type="java.lang.String" writeable="false"
+ description="Fully qualified class name of the managed object" />
+
+ <attribute name="digest" type="java.lang.String"
+ description="Digest algorithm used for storing passwords in a hashed format" />
+
+ <attribute name="dataSourceName" type="java.lang.String"
+ description="The JNDI named JDBC data source for your database" />
+
+ <attribute name="localDataSource" type="boolean"
+ description="Configures if the DataSource is local to the webapp" />
+
+ <attribute name="userQuery" type="java.lang.String"
+ description="SQL query for retrieving the password associated to a user name." />
+
+ <attribute name="roleQuery" type="java.lang.String"
+ description="SQL query for retrieving the roles associated to a user name." />
+
+ <operation name="start" description="Start" impact="ACTION" returnType="void" />
+ <operation name="stop" description="Stop" impact="ACTION" returnType="void" />
+ <operation name="init" description="Init" impact="ACTION" returnType="void" />
+ <operation name="destroy" description="Destroy" impact="ACTION" returnType="void" />
+ </mbean>
+</mbeans-descriptors>
\ No newline at end of file
Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
___________________________________________________________________
Name: svn:eol-style
+ native
13 years, 7 months
JBoss JBPM SVN: r6815 - in projects/jsf-console/branches/jsf-console-3.2-soa: console and 4 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-12 06:07:44 -0500 (Fri, 12 Nov 2010)
New Revision: 6815
Added:
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/pom.xml
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/
projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/src/main/
Modified:
projects/jsf-console/branches/jsf-console-3.2-soa/console/pom.xml
projects/jsf-console/branches/jsf-console-3.2-soa/gpd-deployer/src/main/java/org/jbpm/web/ProcessUploadServlet.java
projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/pom.xml
projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml
Log:
JBPM-2978 support tomcat as deployment target
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/console/pom.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console/pom.xml 2010-11-10 22:27:35 UTC (rev 6814)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
@@ -33,15 +33,5 @@
</dependency>
<!-- Provided Dependencies -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
</project>
Property changes on: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat
___________________________________________________________________
Name: svn:ignore
+ .settings
target
Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.classpath 2010-11-12 11:07:44 UTC (rev 6815)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/.project 2010-11-12 11:07:44 UTC (rev 6815)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>console-tomcat</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/pom.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/pom.xml (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!-- ====================================================================== -->
+<!-- jBPM: Workflow in Java -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ====================================================================== -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>war</packaging>
+ <name>jBPM3 - Tomcat Console</name>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jsf-console-tomcat</artifactId>
+
+ <parent>
+ <artifactId>jsf-console-parent</artifactId>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <version>3.2.10-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <!-- jBPM dependencies -->
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jsf-console</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+
+ <!-- Thirdparty Dependencies -->
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Property changes on: projects/jsf-console/branches/jsf-console-3.2-soa/console-tomcat/pom.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/gpd-deployer/src/main/java/org/jbpm/web/ProcessUploadServlet.java
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/gpd-deployer/src/main/java/org/jbpm/web/ProcessUploadServlet.java 2010-11-10 22:27:35 UTC (rev 6814)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/gpd-deployer/src/main/java/org/jbpm/web/ProcessUploadServlet.java 2010-11-12 11:07:44 UTC (rev 6815)
@@ -49,7 +49,7 @@
* <p>
* Deploys process definitions zipped and posted as multipart requests.
* </p>
- * <h3>Configuration</h3> Servlet context initialization parameters
+ * <h3>Servlet context parameters</h3>
* <table border="1">
* <tr>
* <th>Name</th>
@@ -58,7 +58,7 @@
* </tr>
* <tr>
* <td>jbpm.configuration.resource</td>
- * <td>name of classpath resource containing the configuration</td>
+ * <td>classpath resource containing the jBPM configuration</td>
* <td>jbpm.cfg.xml</td>
* </tr>
* </table>
@@ -184,8 +184,7 @@
jbpmContext.setRollbackOnly();
log.error("failed to deploy " + processDefinition, e);
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Failed to deploy process");
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to deploy process");
}
}
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/pom.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/pom.xml 2010-11-10 22:27:35 UTC (rev 6814)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
@@ -20,7 +20,6 @@
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jsf-console-parent</artifactId>
<version>3.2.10-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
</parent>
<!-- Dependencies -->
@@ -47,6 +46,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
@@ -56,8 +60,6 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
-
- <!-- Runtime Dependencies -->
</dependencies>
<!-- Plugins -->
@@ -87,5 +89,4 @@
</plugin>
</plugins>
</build>
-
</project>
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml 2010-11-10 22:27:35 UTC (rev 6814)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml 2010-11-12 11:07:44 UTC (rev 6815)
@@ -34,22 +34,15 @@
<modules>
<module>console</module>
<module>console-jee5</module>
+ <module>console-tomcat</module>
<module>jbpm4jsf</module>
<module>gpd-deployer</module>
</modules>
<!-- Properties -->
<properties>
- <commons.fileupload.version>1.2.1</commons.fileupload.version>
- <commons.io.version>1.4</commons.io.version>
- <commons.logging.version>1.1.1</commons.logging.version>
- <javax.el.version>1.0</javax.el.version>
<javax.faces.version>1.2_13</javax.faces.version>
- <javax.servlet.version>2.5</javax.servlet.version>
- <jbpm.version>3.2.8</jbpm.version>
- <jboss.gravel.version>1.0.0.GA</jboss.gravel.version>
- <junit.version>3.8.1</junit.version>
- <sun.facelets.version>1.1.15</sun.facelets.version>
+ <jbpm.version>3.2.9</jbpm.version>
</properties>
<!-- DependencyManagement -->
@@ -71,27 +64,27 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>${commons.fileupload.version}</version>
+ <version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
+ <version>1.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons.logging.version}</version>
+ <version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
- <version>${sun.facelets.version}</version>
+ <version>1.1.15</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
- <version>${javax.el.version}</version>
+ <version>1.0</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
@@ -106,12 +99,12 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>${javax.servlet.version}</version>
+ <version>2.5</version>
</dependency>
<dependency>
<groupId>org.jboss.gravel</groupId>
<artifactId>gravel</artifactId>
- <version>${jboss.gravel.version}</version>
+ <version>1.0.0.GA</version>
</dependency>
</dependencies>
</dependencyManagement>
13 years, 7 months
JBoss JBPM SVN: r6814 - in jbpm3/branches/jbpm-3.2-soa/core/src: main/java/org/jbpm/util and 7 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-10 17:27:35 -0500 (Wed, 10 Nov 2010)
New Revision: 6814
Removed:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/DateDbTestUtil.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/StringUtilTest.java
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/EventCallback.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/Semaphore.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/VariableInstanceDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/log/VariableUpdateDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/log/NodeLogDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1071/JBPM1071Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/log/ProcessLogDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/scheduler/exe/TimerDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/ByteUtilTest.java
Log:
JBPM-2959 deprecate org.jbpm.util.Semaphore, replace it with class from backport-util-concurrent;
take out that awful DateDbTestUtil class, instead trim milliseconds from persisted Dates with Calendar
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/EventCallback.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/EventCallback.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/EventCallback.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -35,8 +35,10 @@
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
-import org.jbpm.util.Semaphore;
+import edu.emory.mathcs.backport.java.util.concurrent.Semaphore;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+
public class EventCallback implements Serializable {
public static final int DEFAULT_TIMEOUT = 5 * 60 * 1000;
@@ -103,7 +105,7 @@
}
public static void waitForEvent(String event) {
- waitForEvent(1, event, DEFAULT_TIMEOUT);
+ waitForEvent(event, DEFAULT_TIMEOUT);
}
public static void waitForEvent(String event, long timeout) {
@@ -119,7 +121,7 @@
if (debug) log.debug("waiting for " + event);
Semaphore eventSemaphore = getEventSemaphore(event);
try {
- if (!eventSemaphore.tryAcquire(occurrences, timeout)) {
+ if (!eventSemaphore.tryAcquire(occurrences, timeout, TimeUnit.MILLISECONDS)) {
throw new JbpmException("event '" + event + "' did not occur within " + timeout + " ms");
}
if (debug) log.debug("received '" + event + "' notification");
@@ -133,7 +135,8 @@
synchronized (eventSemaphores) {
Semaphore semaphore = (Semaphore) eventSemaphores.get(event);
if (semaphore == null) {
- semaphore = new Semaphore(0);
+ // request fail semaphore to support atomic multi-acquire
+ semaphore = new Semaphore(0, true);
eventSemaphores.put(event, semaphore);
}
return semaphore;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/Semaphore.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/Semaphore.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/Semaphore.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -9,6 +9,7 @@
*
* @see <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Semaphore.html"
* >java.util.concurrent.Semaphore</a>
+ * @deprecated not in use anymore
*/
public class Semaphore implements Serializable {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/VariableInstanceDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/VariableInstanceDbTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/VariableInstanceDbTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -31,7 +31,6 @@
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.util.DateDbTestUtil;
public class VariableInstanceDbTest extends AbstractDbTestCase {
@@ -50,14 +49,12 @@
}
public void testVariableInstanceString() {
- contextInstance.setVariable("comment",
- "it's not the size that matters, it's how you use it.");
+ contextInstance.setVariable("comment", "it's not the size that matters, it's how you use it.");
processInstance = saveAndReload(processInstance);
contextInstance = processInstance.getContextInstance();
- assertEquals("it's not the size that matters, it's how you use it.",
- contextInstance.getVariable("comment"));
+ assertEquals("it's not the size that matters, it's how you use it.", contextInstance.getVariable("comment"));
}
public void testVariableInstanceLong() {
@@ -154,29 +151,16 @@
}
public void testDate() {
- final Date now = Calendar.getInstance().getTime();
+ // discard milliseconds as some databases have second precision only
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date now = calendar.getTime();
contextInstance.setVariable("a", now);
processInstance = saveAndReload(processInstance);
contextInstance = processInstance.getContextInstance();
- final Date result = (Date) contextInstance.getVariable("a");
- // assertEquals(expected, result);
- log.info("Now: "
- + now
- + ", "
- + now.getTime()
- + ", "
- + DateDbTestUtil.getInstance().convertDateToSeconds(now));
- log.info("Now: "
- + result
- + ", "
- + result.getTime()
- + ", "
- + DateDbTestUtil.getInstance().convertDateToSeconds(result));
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(now),
- DateDbTestUtil.getInstance().convertDateToSeconds(result));
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(now),
- DateDbTestUtil.getInstance().convertDateToSeconds(result));
+ Date result = (Date) contextInstance.getVariable("a");
+ assertEquals(now, result);
}
public void testNullUpdate() {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/log/VariableUpdateDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/log/VariableUpdateDbTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/log/VariableUpdateDbTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -33,7 +33,6 @@
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.logging.exe.LoggingInstance;
-import org.jbpm.util.DateDbTestUtil;
public class VariableUpdateDbTest extends AbstractDbTestCase {
@@ -74,17 +73,20 @@
}
public void testDateUpdateLog() {
- final Date now = Calendar.getInstance().getTime();
- final Date future = new Date(now.getTime() + 5);
+ // discard milliseconds as some databases have second precision only
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date now = calendar.getTime();
+ calendar.add(Calendar.SECOND, 2);
+ Date future = calendar.getTime();
contextInstance.setVariable("a", now);
jbpmContext.save(processInstance);
contextInstance.setVariable("a", future);
VariableUpdateLog variableLog = saveAndReloadUpdateLog(processInstance);
- DateDbTestUtil dbUtilInst = DateDbTestUtil.getInstance();
- assertEquals(dbUtilInst.convertDateToSeconds(now), dbUtilInst.convertDateToSeconds((Date) variableLog.getOldValue()));
- assertEquals(dbUtilInst.convertDateToSeconds(future), dbUtilInst.convertDateToSeconds((Date) variableLog.getNewValue()));
+ assertEquals(now, variableLog.getOldValue());
+ assertEquals(future, variableLog.getNewValue());
}
public void testDoubleUpdateLog() {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/log/NodeLogDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/log/NodeLogDbTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/log/NodeLogDbTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -26,7 +26,6 @@
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.Node;
-import org.jbpm.util.DateDbTestUtil;
public class NodeLogDbTest extends AbstractDbTestCase {
@@ -46,15 +45,16 @@
Node node = new Node();
session.save(node);
- Date enter = new Date();
- Date leave = new Date(enter.getTime() + 5);
+ // discard milliseconds as some databases have second precision only
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date enter = calendar.getTime();
+ calendar.add(Calendar.SECOND, 2);
+ Date leave = calendar.getTime();
NodeLog nodeLog = new NodeLog(node, enter, leave);
nodeLog = (NodeLog) saveAndReload(nodeLog);
- // assertEquals(enter.getTime(), nodeLog.getEnter().getTime());
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(enter), DateDbTestUtil
- .getInstance()
- .convertDateToSeconds(nodeLog.getEnter()));
+ assertEquals(enter, nodeLog.getEnter());
session.delete(nodeLog);
session.delete(node);
@@ -64,19 +64,16 @@
Node node = new Node();
session.save(node);
- final Date enter = Calendar.getInstance().getTime();
- Date leave = new Date(enter.getTime() + 5);
+ // discard milliseconds as some databases have second precision only
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date enter = calendar.getTime();
+ calendar.add(Calendar.SECOND, 2);
+ Date leave = calendar.getTime();
NodeLog nodeLog = new NodeLog(node, enter, leave);
nodeLog = (NodeLog) saveAndReload(nodeLog);
- // assertEquals(leave.getTime(), nodeLog.getLeave().getTime());
- log.info("************************************************************");
- log.info("Enter: " + DateDbTestUtil.getInstance().convertDateToSeconds(enter));
- log.info("Enter: " + DateDbTestUtil.getInstance().convertDateToSeconds(leave));
- log.info("************************************************************");
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(leave), DateDbTestUtil
- .getInstance()
- .convertDateToSeconds(nodeLog.getLeave()));
+ assertEquals(leave, nodeLog.getLeave());
session.delete(nodeLog);
session.delete(node);
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1071/JBPM1071Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1071/JBPM1071Test.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1071/JBPM1071Test.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -15,8 +15,9 @@
import org.jbpm.graph.exe.Comment;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
-import org.jbpm.util.Semaphore;
+import edu.emory.mathcs.backport.java.util.concurrent.Semaphore;
+
/**
* Possible problem in concurrent signaling from multiple threads.
*
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/log/ProcessLogDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/log/ProcessLogDbTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/log/ProcessLogDbTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -21,12 +21,12 @@
*/
package org.jbpm.logging.log;
+import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.exe.Token;
-import org.jbpm.util.DateDbTestUtil;
public class ProcessLogDbTest extends AbstractDbTestCase {
@@ -38,14 +38,15 @@
}
public void testProcessLogDate() {
- Date now = new Date();
+ // discard milliseconds as some databases have second precision only
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date now = calendar.getTime();
+
ProcessLog processLog = new MessageLog();
processLog.setDate(now);
processLog = saveAndReload(processLog);
- // assertEquals(now, processLog.getDate());
- // assertEquals(now.getTime(), processLog.getDate().getTime());
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(now), DateDbTestUtil.getInstance()
- .convertDateToSeconds(processLog.getDate()));
+ assertEquals(now, processLog.getDate());
session.delete(processLog);
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/scheduler/exe/TimerDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/scheduler/exe/TimerDbTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/scheduler/exe/TimerDbTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -38,12 +38,14 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.job.Timer;
import org.jbpm.taskmgmt.exe.TaskInstance;
-import org.jbpm.util.DateDbTestUtil;
public class TimerDbTest extends AbstractDbTestCase {
public void testSaveTimer() {
- final Date now = Calendar.getInstance().getTime();
+ // discard milliseconds as some databases have second precision only
+ Calendar ncal = Calendar.getInstance();
+ ncal.set(Calendar.MILLISECOND, 0);
+ Date now = ncal.getTime();
Timer timer = new Timer();
timer.setName("timer-name");
@@ -57,14 +59,7 @@
timer = (Timer) session.load(Timer.class, new Long(timer.getId()));
assertEquals("timer-name", timer.getName());
- // we test for the same date in a simple format
- // DateFormat df = SimpleDateFormat.getDateInstance();
- // assertEquals(df.format(now), df.format(timer.getDueDate()));
-
- // we test for each part of the date to see where we fail per database
- // to help with debugging.
- Calendar ncal = new GregorianCalendar();
- ncal.setTime(now);
+ // test each calendar field to ensure second precision across all databases
Calendar tcal = new GregorianCalendar();
tcal.setTime(timer.getDueDate());
assertEquals(ncal.get(Calendar.YEAR), tcal.get(Calendar.YEAR));
@@ -73,8 +68,6 @@
assertEquals(ncal.get(Calendar.HOUR_OF_DAY), tcal.get(Calendar.HOUR_OF_DAY));
assertEquals(ncal.get(Calendar.MINUTE), tcal.get(Calendar.MINUTE));
assertEquals(ncal.get(Calendar.SECOND), tcal.get(Calendar.SECOND));
- assertEquals(DateDbTestUtil.getInstance().convertDateToSeconds(now), DateDbTestUtil.getInstance()
- .convertDateToSeconds(timer.getDueDate()));
assertEquals("transition-name", timer.getTransitionName());
assertEquals("repeat-duration", timer.getRepeat());
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/ByteUtilTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/ByteUtilTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/ByteUtilTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -6,22 +6,23 @@
public class ByteUtilTest extends AbstractJbpmTestCase {
-
public void testBytesToString() {
byte[] bytes = new byte[] {
- (byte) 0x00, (byte) 0x01, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x21, (byte) 0x99, (byte) 0x9a,
- (byte) 0xa9, (byte) 0xbc, (byte) 0xde, (byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ (byte) 0x00, (byte) 0x01, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x21,
+ (byte) 0x99, (byte) 0x9a, (byte) 0xa9, (byte) 0xbc, (byte) 0xde, (byte) 0xff,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
};
-
+
assertEquals("000110111221999aa9bcdeff00000000", ByteUtil.toString(bytes));
}
-
+
public void testBytesFromString() {
byte[] bytes = new byte[] {
- (byte) 0x00, (byte) 0x01, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x21, (byte) 0x99, (byte) 0x9a,
- (byte) 0xa9, (byte) 0xbc, (byte) 0xde, (byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ (byte) 0x00, (byte) 0x01, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x21,
+ (byte) 0x99, (byte) 0x9a, (byte) 0xa9, (byte) 0xbc, (byte) 0xde, (byte) 0xff,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
};
-
+
assertTrue(Arrays.equals(bytes, ByteUtil.fromString("000110111221999aa9bcdeff00000000")));
}
}
Deleted: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/DateDbTestUtil.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/DateDbTestUtil.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/DateDbTestUtil.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -1,26 +0,0 @@
-package org.jbpm.util;
-
-public class DateDbTestUtil {
- private static DateDbTestUtil instance;
-
- private DateDbTestUtil() {}
-
- public static DateDbTestUtil getInstance() {
- if(instance == null) {
- instance = new DateDbTestUtil();
- }
- return instance;
- }
-
- /**
- * This method returns the number of seconds by absolutely ignoring the
- * milliseconds. No ceiling or flooring is done.
- *
- * @param date
- * @return Date converted to seconds.
- */
- public long convertDateToSeconds(java.util.Date date) {
- return ((date.getTime()) - (date.getTime() % 1000)) / 1000;
- }
-
-}
Deleted: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/StringUtilTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/StringUtilTest.java 2010-11-10 21:11:56 UTC (rev 6813)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/util/StringUtilTest.java 2010-11-10 22:27:35 UTC (rev 6814)
@@ -1,12 +0,0 @@
-package org.jbpm.util;
-
-import org.jbpm.AbstractJbpmTestCase;
-
-
-public class StringUtilTest extends AbstractJbpmTestCase {
-
- public void testConv() {
- // System.out.println(StringUtil.toHexString(new byte[]{(byte) 0x5a,(byte) 0x23,(byte) 0x7c,(byte) 0x0b}));
- // System.out.println(StringUtil.toHexStringHibernate(new byte[]{(byte) 0x5a,(byte) 0x23,(byte) 0x7c,(byte) 0x0b}));
- }
-}
13 years, 7 months
JBoss JBPM SVN: r6813 - in jbpm3/branches/jbpm-3.2-soa: distribution and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-10 16:11:56 -0500 (Wed, 10 Nov 2010)
New Revision: 6813
Modified:
jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/CommandListenerBean.java
jbpm3/branches/jbpm-3.2-soa/pom.xml
Log:
JBPM-2945 remove commons-lang dependency; its limited usage does not justify inclusion in the distribution
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-10 21:11:56 UTC (rev 6813)
@@ -183,10 +183,6 @@
<artifactId>bsh</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
<groupId>org.jboss.cluster</groupId>
<artifactId>hibernate-jbc-cacheprovider</artifactId>
</dependency>
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2010-11-10 21:11:56 UTC (rev 6813)
@@ -83,11 +83,6 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<profiles>
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/CommandListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/CommandListenerBean.java 2010-11-10 21:01:03 UTC (rev 6812)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/CommandListenerBean.java 2010-11-10 21:11:56 UTC (rev 6813)
@@ -36,7 +36,6 @@
import javax.jms.ObjectMessage;
import javax.jms.Session;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.command.Command;
@@ -107,22 +106,22 @@
Object result;
try {
if (log.isDebugEnabled()) {
- log.debug("executing " + ReflectionToStringBuilder.toString(command));
+ log.debug("executing " + command);
}
result = commandService.execute(command);
if (log.isTraceEnabled()) {
- log.trace(ReflectionToStringBuilder.toString(command) + " completed successfully, committing");
+ log.trace(command + " completed successfully, committing");
}
}
catch (RuntimeException e) {
// if this is a locking exception, keep it quiet
if (DbPersistenceService.isLockingException(e)) {
StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(message
- + " failed to execute " + ReflectionToStringBuilder.toString(command), e);
+ + " failed to execute " + command, e);
}
else {
- log.error(message + " failed to execute " + ReflectionToStringBuilder.toString(command), e);
+ log.error(message + " failed to execute " + command, e);
}
// MDBs are not supposed to throw exceptions
messageDrivenContext.setRollbackOnly();
@@ -157,11 +156,11 @@
return (Command) object;
}
else {
- log.warn("not a command: " + ReflectionToStringBuilder.toString(object));
+ log.warn(object + " is not a command");
}
}
else {
- log.warn("not an object message: " + message);
+ log.warn(message + " is not an object message");
}
return null;
}
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-10 21:11:56 UTC (rev 6813)
@@ -136,11 +136,6 @@
<version>1.4</version>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
13 years, 7 months
JBoss JBPM SVN: r6812 - in jbpm3/branches/jbpm-3.2-soa: core and 4 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-10 16:01:03 -0500 (Wed, 10 Nov 2010)
New Revision: 6812
Modified:
jbpm3/branches/jbpm-3.2-soa/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/db/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/etc/version.info.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
Log:
JBPM-2959 ship backport-util-concurrent library with distribution
Modified: jbpm3/branches/jbpm-3.2-soa/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -29,7 +29,6 @@
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
<optional>true</optional>
</dependency>
<dependency>
@@ -92,6 +91,12 @@
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
@@ -193,10 +198,12 @@
</plugin>
<plugin>
- <artifactId>maven-surefire-plugin</artifactId>
+ <artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
+ <!-- database schema creation is costly; some drivers cache metadata -->
<exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
+ <!-- performance test is slow; misplaced along functional tests -->
<exclude>org/jbpm/perf/PerformanceTest.java</exclude>
</excludes>
</configuration>
@@ -225,34 +232,6 @@
</profile>
<!--
- Name: mssql
- Desc: SQL Server Test Exclusions
- -->
- <profile>
- <id>mssql</id>
- <activation>
- <property>
- <name>database</name>
- <value>mssql</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- <exclude>org/jbpm/job/executor/JobExecutorDbTest.java</exclude>
- <exclude>org/jbpm/perf/PerformanceTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!--
Name: sybase
Desc: Sybase Test Exclusions
-->
@@ -270,8 +249,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
+ <!-- JBPM-2958 driver fails to retrieve database metadata -->
<exclude>org/jbpm/jbpm2958/TimerCalendarTest.java</exclude>
+ <!-- default exclusions -->
+ <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
<exclude>org/jbpm/perf/PerformanceTest.java</exclude>
</excludes>
</configuration>
Modified: jbpm3/branches/jbpm-3.2-soa/db/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -59,6 +59,7 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -175,6 +175,14 @@
<artifactId>ant</artifactId>
</dependency>
<dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
@@ -182,6 +190,10 @@
<groupId>org.jboss.cluster</groupId>
<artifactId>hibernate-jbc-cacheprovider</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
<!-- Database Drivers -->
<dependency>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/etc/version.info.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/etc/version.info.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/etc/version.info.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -5,6 +5,7 @@
<classpathentry path="lib/antlr.jar" />
<classpathentry path="lib/asm.jar"/>
+ <classpathentry path="lib/backport-util-concurrent.jar" />
<classpathentry path="lib/bsh.jar"/>
<classpathentry path="lib/cglib.jar"/>
<classpathentry path="lib/commons-collections.jar"/>
@@ -13,7 +14,6 @@
<classpathentry path="lib/hibernate.jar"/>
<classpathentry path="lib/hsqldb.jar"/>
<classpathentry path="lib/junit.jar"/>
- <classpathentry path="lib/log4j.jar"/>
<config path="config"/>
<examples path="examples" />
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -178,6 +178,7 @@
<fileset dir="@{assemblyDirectory}/lib" targetdir="$INSTALL_PATH/lib">
<include name="antlr.jar" />
<include name="asm.jar" />
+ <include name="backport-util-concurrent.jar" />
<include name="bsh.jar" />
<include name="cglib.jar" />
<include name="commons-collections.jar" />
@@ -186,7 +187,6 @@
<include name="hibernate.jar" />
<include name="hsqldb.jar" />
<include name="junit.jar" />
- <include name="log4j.jar" />
</fileset>
<!-- jbpm3/src - Must be called 'src' because the GPD depends on it -->
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-10 07:15:16 UTC (rev 6811)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-11-10 21:01:03 UTC (rev 6812)
@@ -90,6 +90,11 @@
<version>1.7.0</version>
</dependency>
<dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
<groupId>bsh</groupId>
<artifactId>bsh</artifactId>
<version>1.3.0</version>
13 years, 7 months
JBoss JBPM SVN: r6811 - jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-10 02:15:16 -0500 (Wed, 10 Nov 2010)
New Revision: 6811
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
Log:
JBPM-2959 do not log InterruptException in JobExecutorThread, it does not provide useful information
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-10 06:38:42 UTC (rev 6810)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-10 07:15:16 UTC (rev 6811)
@@ -128,7 +128,7 @@
return (Job) jobExecutor.getQueue().take();
}
catch (InterruptedException e) {
- if (log.isDebugEnabled()) log.debug(getName() + " got interrupted", e);
+ if (log.isDebugEnabled()) log.debug(getName() + " got interrupted");
return null;
}
}
13 years, 7 months
JBoss JBPM SVN: r6810 - in jbpm3/branches/jbpm-3.2-soa/core/src/main: java/org/jbpm/job/executor and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-10 01:38:42 -0500 (Wed, 10 Nov 2010)
New Revision: 6810
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/Deactivable.java
Removed:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/msg/db/DbMessageService.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
Log:
JBPM-2959 backport dispatcher thread from jBPM 4;
employ BlockingQueue instead of ThreadPoolExecutor to not abandon JobExecutorThread
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -41,7 +41,7 @@
public class JobSession {
- final Session session;
+ private final Session session;
public JobSession(Session session) {
this.session = session;
@@ -50,14 +50,13 @@
public Job getFirstAcquirableJob(String lockOwner) {
try {
Query query;
- if (lockOwner != null) {
+ if (lockOwner == null) {
+ query = session.getNamedQuery("JobSession.getFirstUnownedAcquirableJob");
+ }
+ else {
query = session.getNamedQuery("JobSession.getFirstAcquirableJob")
.setString("lockOwner", lockOwner);
}
- else {
- query = session.getNamedQuery("JobSession.getFirstAcquirableJobExcludingOwned");
- }
-
return (Job) query.setTimestamp("now", new Date()).setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
@@ -94,7 +93,7 @@
try {
Query query;
if (lockOwner == null) {
- query = session.getNamedQuery("JobSession.getFirstDueJobExcludingOwned");
+ query = session.getNamedQuery("JobSession.getFirstUnownedDueJob");
}
else if (monitoredJobs == null || monitoredJobs.isEmpty()) {
query = session.getNamedQuery("JobSession.getFirstDueJob")
@@ -105,7 +104,6 @@
.setString("lockOwner", lockOwner)
.setParameterList("monitoredJobIds", monitoredJobs);
}
-
return (Job) query.setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
Added: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/Deactivable.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/Deactivable.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/Deactivable.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.job.executor;
+
+/**
+ * A thread that can be deactivated.
+ *
+ * @author Alejandro Guizar
+ */
+interface Deactivable {
+
+ /**
+ * Tells this thread to stop running. Execution will cease shortly afterwards.
+ */
+ void deactivate();
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/Deactivable.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -35,13 +35,13 @@
*
* @author Alejandro Guizar
*/
-class DispatcherThread extends Thread {
+class DispatcherThread extends Thread implements Deactivable {
+ public static final String DEFAULT_NAME = "Dispatcher";
+
private static final Log log = LogFactory.getLog(DispatcherThread.class);
- public static final String DEFAULT_NAME = "Dispatcher";
-
- private JobExecutor jobExecutor;
+ private final JobExecutor jobExecutor;
private volatile boolean active = true;
DispatcherThread(JobExecutor jobExecutor) {
@@ -49,7 +49,7 @@
}
DispatcherThread(String name, JobExecutor jobExecutor) {
- super(name);
+ super(jobExecutor.getThreadGroup(), name);
this.jobExecutor = jobExecutor;
}
@@ -61,7 +61,7 @@
// submit job
if (job != null) submitJob(job);
- // if still active wait for next job
+ // if still active, wait or sleep
if (active) {
try {
if (job != null) {
@@ -77,7 +77,7 @@
}
else {
// sleep instead of waiting on jobExecutor
- // to prevent DbMessageService from waking up this thread
+ // to prevent message/scheduler service from waking up this thread
sleep(retryInterval);
// after an exception, double the current retry interval
// to avoid continuous failures during anomalous conditions
@@ -145,11 +145,45 @@
}
private void submitJob(Job job) {
- JobParcel jobParcel = new JobParcel(jobExecutor, job);
- jobExecutor.getExecutorService().execute(jobParcel);
- if (log.isDebugEnabled()) log.debug("submitted " + job);
+ boolean debug = log.isDebugEnabled();
+ try {
+ jobExecutor.getQueue().put(job);
+ if (debug) log.debug("submitted " + job);
+ }
+ catch (InterruptedException e) {
+ unlockJob(job);
+ if (log.isDebugEnabled()) log.debug(getName() + " got interrupted");
+ }
}
+ private void unlockJob(Job job) {
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ // reattach job to persistence context
+ jbpmContext.getJobSession().reattachJob(job);
+
+ // unlock job so it can be dispatched again
+ job.setLockOwner(null);
+ job.setLockTime(null);
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ log.warn("failed to unlock " + job, e);
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
+ catch (RuntimeException e) {
+ log.warn("failed to unlock " + job, e);
+ }
+ }
+ }
+
private long getWaitPeriod(int currentIdleInterval) {
Date nextDueDate = getNextDueDate();
if (nextDueDate != null) {
@@ -193,9 +227,6 @@
return nextDueDate;
}
- /**
- * Indicates that this thread should stop running. Execution will cease shortly afterwards.
- */
public void deactivate() {
if (active) {
active = false;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -3,27 +3,22 @@
import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmConfiguration;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
-import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException;
-import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler;
+import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
import edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory;
-import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
public class JobExecutor implements Serializable {
@@ -43,13 +38,12 @@
/** @deprecated property has no effect */
protected int lockBufferTime;
- ThreadGroup threadGroup;
- private ExecutorService executorService;
+ private ThreadGroup threadGroup;
+ private BlockingQueue queue = new SynchronousQueue();
/** @deprecated call {@link #getThreads()} instead */
protected Map threads;
-
- private DispatcherThread dispatcherThread;
+ /** @deprecated call {@link #getThreads()} instead */
protected LockMonitorThread lockMonitorThread;
protected Map monitoredJobIds = new Hashtable();
@@ -65,7 +59,10 @@
// create thread group
threadGroup = new ThreadGroup(name) {
public void uncaughtException(Thread thread, Throwable throwable) {
- if (thread instanceof DispatcherThread) {
+ if (thread instanceof JobExecutorThread) {
+ startThread(thread.getName());
+ }
+ else if (thread instanceof DispatcherThread) {
startDispatcherThread();
}
else if (thread instanceof LockMonitorThread) {
@@ -75,50 +72,21 @@
}
};
- // create thread factory
- ThreadFactory threadFactory = new ThreadFactory() {
- public Thread newThread(Runnable task) {
- Thread thread = new Thread(threadGroup, task, getNextThreadName());
- if (thread.isDaemon()) thread.setDaemon(false);
- if (thread.getPriority() != Thread.NORM_PRIORITY)
- thread.setPriority(Thread.NORM_PRIORITY);
- return thread;
- }
- };
+ // start executor threads
+ for (int i = 1; i <= nbrOfThreads; i++) {
+ startThread(getThreadName(i));
+ }
- // start executor service
- executorService = new ThreadPoolExecutor(nbrOfThreads,
- nbrOfThreads,
- 0L,
- TimeUnit.MILLISECONDS,
- new SynchronousQueue(),
- threadFactory,
- JobRejectionHandler.INSTANCE);
-
- // start helper threads
+ // start control threads
startDispatcherThread();
startLockMonitorThread();
isStarted = true;
}
else if (log.isDebugEnabled()) {
- log.debug("ignoring start: " + name + " already started'");
+ log.debug("ignoring start: " + name + " already started");
}
}
- private static class JobRejectionHandler implements RejectedExecutionHandler {
-
- static final JobRejectionHandler INSTANCE = new JobRejectionHandler();
-
- public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) {
- try {
- executor.getQueue().put(task);
- }
- catch (InterruptedException e) {
- throw new RejectedExecutionException("queuing " + task + " got interrupted", e);
- }
- }
- }
-
/**
* tells all threads in this job executor to stop. Threads may be in the middle of processing
* a job and they will finish that first. Use {@link #stopAndJoin()} in case you want a method
@@ -133,53 +101,55 @@
return Collections.EMPTY_LIST;
}
- // list active threads
- Thread[] activeThreads = new Thread[threadGroup.activeCount()];
- threadGroup.enumerate(activeThreads);
+ log.info("stopping " + name);
+ isStarted = false;
- // tell threads to stop
- stopThreads();
+ // fetch active threads
+ Thread[] activeThreads = new Thread[nbrOfThreads + 2];
+ int activeCount = threadGroup.enumerate(activeThreads, false);
- // return formerly active threads
- return Arrays.asList(activeThreads);
- }
-
- public void stopAndJoin() throws InterruptedException {
- if (!isStarted) {
- if (log.isDebugEnabled()) log.debug("ignoring stop, " + name + " not started");
- return;
+ // deactivate threads
+ List deactivatedThreads = new ArrayList(activeCount);
+ for (int i = 0; i < activeCount; i++) {
+ Thread thread = activeThreads[i];
+ if (thread instanceof Deactivable) {
+ Deactivable deactivable = (Deactivable) thread;
+ deactivable.deactivate();
+ deactivatedThreads.add(thread);
+ }
}
- // tell threads to stop
- stopThreads();
-
- // wait for executor to terminate
- executorService.awaitTermination(1, TimeUnit.MINUTES);
-
- // join helper threads
- dispatcherThread.join();
- lockMonitorThread.join();
+ // return deactivated threads
+ return deactivatedThreads;
}
- private void stopThreads() {
- log.info("stopping " + name);
- isStarted = false;
+ public void stopAndJoin() throws InterruptedException {
+ // deactivate threads
+ List threads = stop();
- // shut down execution service
- executorService.shutdown();
-
- // deactivate helper threads
- dispatcherThread.deactivate();
- lockMonitorThread.deactivate();
+ // join deactivated threads
+ for (Iterator i = threads.iterator(); i.hasNext();) {
+ Thread thread = (Thread) i.next();
+ thread.join();
+ }
}
public void ensureThreadsAreActive() {
- // executor service looks after its own threads
- // just confirm dispatcher and lock monitor are alive
- if (!dispatcherThread.isAlive()) {
+ Map threads = getThreads();
+
+ // check executor threads
+ for (int i = 1; i <= nbrOfThreads; i++) {
+ String threadName = getThreadName(i);
+ if (!threads.containsKey(threadName)) {
+ startThread(threadName);
+ }
+ }
+
+ // check control threads
+ if (!threads.containsKey(getDispatcherThreadName())) {
startDispatcherThread();
}
- if (!lockMonitorThread.isAlive()) {
+ if (!threads.containsKey(getLockMonitorThreadName())) {
startLockMonitorThread();
}
}
@@ -188,16 +158,19 @@
return threadGroup;
}
- ExecutorService getExecutorService() {
- return executorService;
+ BlockingQueue getQueue() {
+ return queue;
}
+ private String getThreadName(int index) {
+ return name + '@' + getHostAddress() + ":Executor-" + index;
+ }
+
/** @deprecated no longer invoked */
protected void startThread() {
startThread(getNextThreadName());
}
- /** @deprecated no longer invoked */
protected void startThread(String threadName) {
Thread thread = createThread(threadName);
@@ -205,56 +178,58 @@
thread.start();
}
- /** @deprecated no longer invoked */
protected Thread createThread(String threadName) {
return new JobExecutorThread(threadName, this);
}
+ /** @deprecated no longer invoked */
protected String getNextThreadName() {
return getThreadName(threadGroup.activeCount() + 1);
}
/** @deprecated no longer invoked */
protected String getLastThreadName() {
- return getThreadName(threadGroup.activeCount());
+ Map threads = getThreads();
+ for (int i = nbrOfThreads; i > 0; i--) {
+ String threadName = getThreadName(i);
+ if (threads.containsKey(threadName)) return threadName;
+ }
+ return null;
}
/** @deprecated no longer invoked */
protected synchronized Thread stopThread() {
- String threadName = getLastThreadName();
- if (log.isDebugEnabled()) log.debug("stopping " + threadName);
-
- Thread thread = (Thread) threads.remove(threadName);
- stopThread(thread);
- return thread;
- }
-
- private void stopThread(Thread thread) {
- if (thread instanceof JobExecutorThread) {
- JobExecutorThread executor = (JobExecutorThread) thread;
- executor.deactivate();
+ Map threads = getThreads();
+ for (int i = nbrOfThreads; i > 0; i--) {
+ String threadName = getThreadName(i);
+ JobExecutorThread executorThread = (JobExecutorThread) threads.get(threadName);
+ if (executorThread != null) {
+ executorThread.deactivate();
+ return executorThread;
+ }
}
- else if (thread instanceof LockMonitorThread) {
- LockMonitorThread monitor = (LockMonitorThread) thread;
- monitor.deactivate();
- }
+ return null;
}
- private String getThreadName(int index) {
- return name + '@' + getHostAddress() + ":Executor-" + index;
+ private String getDispatcherThreadName() {
+ return name + '@' + getHostAddress() + ':' + DispatcherThread.DEFAULT_NAME;
}
void startDispatcherThread() {
- String threadName = name + '@' + getHostAddress() + ':' + DispatcherThread.DEFAULT_NAME;
- dispatcherThread = new DispatcherThread(threadName, this);
+ String threadName = getDispatcherThreadName();
+ Thread dispatcherThread = new DispatcherThread(threadName, this);
if (log.isDebugEnabled()) log.debug("starting " + threadName);
dispatcherThread.start();
}
+ private String getLockMonitorThreadName() {
+ return name + '@' + getHostAddress() + ':' + LockMonitorThread.DEFAULT_NAME;
+ }
+
void startLockMonitorThread() {
- String threadName = name + '@' + getHostAddress() + ':' + LockMonitorThread.DEFAULT_NAME;
- lockMonitorThread = new LockMonitorThread(threadName, this);
+ String threadName = getLockMonitorThreadName();
+ Thread lockMonitorThread = new LockMonitorThread(threadName, this);
if (log.isDebugEnabled()) log.debug("starting " + threadName);
lockMonitorThread.start();
@@ -269,8 +244,8 @@
}
}
- public Set getMonitoredJobIds() {
- return new HashSet(monitoredJobIds.values());
+ public Collection getMonitoredJobIds() {
+ return monitoredJobIds.values();
}
public void addMonitoredJobId(String threadName, long jobId) {
@@ -379,12 +354,14 @@
}
public Map getThreads() {
- Thread[] threadList = new Thread[threadGroup.activeCount()];
- int threadCount = threadGroup.enumerate(threadList);
+ // fetch active threads
+ Thread[] activeThreads = new Thread[nbrOfThreads + 2];
+ int activeCount = threadGroup.enumerate(activeThreads, false);
- Map threadMap = new HashMap(threadCount);
- for (int i = 0; i < threadCount; i++) {
- Thread thread = threadList[i];
+ // map threads by name
+ Map threadMap = new HashMap(activeCount);
+ for (int i = 0; i < activeCount; i++) {
+ Thread thread = activeThreads[i];
threadMap.put(thread.getName(), thread);
}
return threadMap;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -18,10 +18,10 @@
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
-public class JobExecutorThread extends Thread {
+public class JobExecutorThread extends Thread implements Deactivable {
private final JobExecutor jobExecutor;
- private volatile boolean isActive = true;
+ private volatile boolean active = true;
public JobExecutorThread(String name, JobExecutor jobExecutor) {
super(jobExecutor.getThreadGroup(), name);
@@ -39,54 +39,25 @@
}
public void run() {
- int retryInterval = jobExecutor.getRetryInterval();
- while (isActive) {
- // acquire job; on exception, call returns null
+ while (active) {
+ // take on next job
Job job = acquireJob();
- // execute job
- boolean success = true;
+ // if an exception occurs, acquireJob() returns null
if (job != null) {
try {
executeJob(job);
}
catch (Exception e) {
- // on exception, call returns normally
+ // save exception stack trace
+ // if another exception occurs, it is not rethrown
saveJobException(job, e);
- success = false;
}
- }
-
- // if still active wait for next batch
- if (isActive) {
- try {
- if (success) {
- // reset the current retry interval
- retryInterval = jobExecutor.getRetryInterval();
- // wait for next due job
- long waitPeriod = getWaitPeriod(jobExecutor.getIdleInterval());
- if (waitPeriod > 0) {
- synchronized (jobExecutor) {
- jobExecutor.wait(waitPeriod);
- }
- }
- }
- else {
- // sleep instead of waiting on jobExecutor
- // to prevent DbMessageService from waking up this thread
- sleep(retryInterval);
- // after an exception, double the current retry interval
- // to avoid continuous failures during anomalous conditions
- retryInterval *= 2;
- // enforce maximum idle interval
- int maxIdleInterval = jobExecutor.getMaxIdleInterval();
- if (retryInterval > maxIdleInterval || retryInterval < 0) {
- retryInterval = maxIdleInterval;
- }
- }
+ catch (Error e) {
+ // unlock job so it can be dispatched again
+ // if another exception occurs, it is not rethrown
+ unlockJob(job);
+ throw e;
}
- catch (InterruptedException e) {
- if (log.isDebugEnabled()) log.debug(getName() + " got interrupted");
- }
}
}
log.info(getName() + " leaves cyberspace");
@@ -94,137 +65,91 @@
/** @deprecated call {@link #acquireJob()} instead **/
protected Collection acquireJobs() {
- boolean debug = log.isDebugEnabled();
Collection jobs;
- // acquire job executor's monitor before creating context and allocating resources
- synchronized (jobExecutor) {
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- // search for available job
- String lockOwner = getName();
- JobSession jobSession = jbpmContext.getJobSession();
- Job firstJob = jobSession.getFirstAcquirableJob(lockOwner);
- // is there a job?
- if (firstJob != null) {
- // is job exclusive?
- if (firstJob.isExclusive()) {
- // find other exclusive jobs
- ProcessInstance processInstance = firstJob.getProcessInstance();
- jobs = jobSession.findExclusiveJobs(lockOwner, processInstance);
- if (debug) log.debug("acquiring exclusive " + jobs + " for " + processInstance);
- }
- else {
- jobs = Collections.singletonList(firstJob);
- if (debug) log.debug("acquiring " + firstJob);
- }
-
- // acquire jobs
- Date lockTime = new Date();
- for (Iterator i = jobs.iterator(); i.hasNext();) {
- // lock job
- Job job = (Job) i.next();
- job.setLockOwner(lockOwner);
- job.setLockTime(lockTime);
- // has job failed previously?
- if (job.getException() != null) {
- // decrease retry count
- int retries = job.getRetries() - 1;
- job.setRetries(retries);
- if (debug) log.debug(job + " has " + retries + " retries remaining");
- }
- }
- if (debug) log.debug("acquired " + jobs);
+ boolean debug = log.isDebugEnabled();
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ // search for available job
+ String lockOwner = getName();
+ JobSession jobSession = jbpmContext.getJobSession();
+ Job firstJob = jobSession.getFirstAcquirableJob(lockOwner);
+ // is there a job?
+ if (firstJob != null) {
+ // is job exclusive?
+ if (firstJob.isExclusive()) {
+ // find other exclusive jobs
+ ProcessInstance processInstance = firstJob.getProcessInstance();
+ jobs = jobSession.findExclusiveJobs(lockOwner, processInstance);
+ if (debug) log.debug("acquiring exclusive " + jobs + " for " + processInstance);
}
else {
- jobs = Collections.EMPTY_LIST;
- if (debug) log.debug("no acquirable job found");
+ jobs = Collections.singletonList(firstJob);
+ if (debug) log.debug("acquiring " + firstJob);
}
+
+ // acquire jobs
+ Date lockTime = new Date();
+ for (Iterator i = jobs.iterator(); i.hasNext();) {
+ // lock job
+ Job job = (Job) i.next();
+ job.setLockOwner(lockOwner);
+ job.setLockTime(lockTime);
+ }
+ if (debug) log.debug("acquired " + jobs);
}
+ else {
+ jobs = Collections.EMPTY_LIST;
+ if (debug) log.debug("no acquirable job found");
+ }
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ if (debug) log.debug("failed to acquire jobs", e);
+ jobs = Collections.EMPTY_LIST;
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
jobs = Collections.EMPTY_LIST;
if (debug) log.debug("failed to acquire jobs", e);
}
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- try {
- jbpmContext.close();
- }
- catch (RuntimeException e) {
- jobs = Collections.EMPTY_LIST;
- if (debug) log.debug("failed to acquire jobs", e);
- }
- }
}
return jobs;
}
protected Job acquireJob() {
- boolean debug = log.isDebugEnabled();
- Job job;
- // acquire job executor's monitor before creating context and allocating resources
- synchronized (jobExecutor) {
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- // search for available job
- String lockOwner = getName();
- JobSession jobSession = jbpmContext.getJobSession();
- job = jobSession.getFirstAcquirableJob(lockOwner);
- // is there a job?
- if (job != null) {
- // lock job
- job.setLockOwner(lockOwner);
- job.setLockTime(new Date());
- // has job failed previously?
- if (job.getException() != null) {
- // decrease retry count
- int retries = job.getRetries() - 1;
- job.setRetries(retries);
- if (debug) log.debug(job + " has " + retries + " retries remaining");
- }
- if (debug) log.debug("acquired " + job);
- }
- else if (debug) log.debug("no acquirable job found");
- }
- catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
- job = null;
- if (debug) log.debug("failed to acquire job", e);
- }
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- try {
- jbpmContext.close();
- }
- catch (RuntimeException e) {
- job = null;
- if (debug) log.debug("failed to acquire job", e);
- }
- }
+ try {
+ return (Job) jobExecutor.getQueue().take();
}
- return job;
+ catch (InterruptedException e) {
+ if (log.isDebugEnabled()) log.debug(getName() + " got interrupted", e);
+ return null;
+ }
}
protected void executeJob(Job job) throws Exception {
JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
try {
- if (job.isExclusive()) {
- jbpmContext.getGraphSession().lockProcessInstance(job.getProcessInstance());
- }
-
+ // reattach job to persistence context
JobSession jobSession = jbpmContext.getJobSession();
jobSession.reattachJob(job);
-
+
// register process instance for automatic save
// https://jira.jboss.org/browse/JBPM-1015
- jbpmContext.addAutoSaveProcessInstance(job.getProcessInstance());
+ ProcessInstance processInstance = job.getProcessInstance();
+ jbpmContext.addAutoSaveProcessInstance(processInstance);
+ // if job is exclusive, lock process instance
+ if (job.isExclusive()) {
+ jbpmContext.getGraphSession().lockProcessInstance(processInstance);
+ }
+
if (log.isDebugEnabled()) log.debug("executing " + job);
if (job.execute(jbpmContext)) jobSession.deleteJob(job);
}
@@ -251,21 +176,27 @@
log.error("failed to execute " + job, exception);
}
- boolean debug = log.isDebugEnabled();
JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
try {
// do not reattach existing job as it contains undesired updates
- JobSession jobSession = jbpmContext.getJobSession();
- job = jobSession.loadJob(job.getId());
+ jbpmContext.getSession().refresh(job);
// print and save exception
StringWriter out = new StringWriter();
exception.printStackTrace(new PrintWriter(out));
job.setException(out.toString());
+
+ // unlock job so it can be dispatched again
+ job.setLockOwner(null);
+ job.setLockTime(null);
+ // notify job executor
+ synchronized (jobExecutor) {
+ jobExecutor.notify();
+ }
}
catch (RuntimeException e) {
jbpmContext.setRollbackOnly();
- if (debug) log.debug("failed to save job exception", e);
+ log.warn("failed to save exception for " + job, e);
}
catch (Error e) {
jbpmContext.setRollbackOnly();
@@ -276,11 +207,45 @@
jbpmContext.close();
}
catch (RuntimeException e) {
- if (debug) log.debug("failed to save job exception", e);
+ log.warn("failed to save exception for " + job, e);
}
}
}
+ private void unlockJob(Job job) {
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ // do not reattach existing job as it contains undesired updates
+ jbpmContext.getSession().refresh(job);
+
+ // unlock job
+ job.setLockOwner(null);
+ job.setLockTime(null);
+ // notify job executor
+ synchronized (jobExecutor) {
+ jobExecutor.notify();
+ }
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ log.warn("failed to unlock " + job, e);
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ // do not rethrow as this method is already called in response to an Error
+ log.warn("failed to unlock " + job, e);
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
+ catch (RuntimeException e) {
+ log.warn("failed to unlock " + job, e);
+ }
+ }
+ }
+
+ /** @deprecated moved to {@link DispatcherThread} */
protected long getWaitPeriod(int currentIdleInterval) {
Date nextDueDate = getNextDueDate();
if (nextDueDate != null) {
@@ -290,6 +255,7 @@
return currentIdleInterval;
}
+ /** @deprecated moved to {@link DispatcherThread} */
protected Date getNextDueDate() {
Date nextDueDate;
JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
@@ -334,13 +300,9 @@
if (isActive == false) deactivate();
}
- /**
- * Indicates that this thread should stop running. Execution will cease
- * shortly afterwards.
- */
public void deactivate() {
- if (isActive) {
- isActive = false;
+ if (active) {
+ active = false;
interrupt();
}
}
Deleted: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.job.executor;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.jbpm.JbpmContext;
-import org.jbpm.db.JobSession;
-import org.jbpm.job.Job;
-import org.jbpm.persistence.db.DbPersistenceService;
-import org.jbpm.persistence.db.StaleObjectLogConfigurer;
-
-/**
- * @author Alejandro Guizar
- */
-class JobParcel implements Runnable {
-
- private static final Log log = LogFactory.getLog(JobParcel.class);
-
- private final JobExecutor jobExecutor;
- private final Job job;
-
- JobParcel(JobExecutor jobExecutor, Job job) {
- this.jobExecutor = jobExecutor;
- this.job = job;
- }
-
- public void run() {
- try {
- executeJob();
- }
- catch (Exception e) {
- // on exception, call returns normally
- saveJobException(e);
- }
- }
-
- private void executeJob() throws Exception {
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- if (job.isExclusive()) {
- jbpmContext.getGraphSession().lockProcessInstance(job.getProcessInstance());
- }
-
- JobSession jobSession = jbpmContext.getJobSession();
- jobSession.reattachJob(job);
-
- // register process instance for automatic save
- // https://jira.jboss.org/browse/JBPM-1015
- jbpmContext.addAutoSaveProcessInstance(job.getProcessInstance());
-
- if (log.isDebugEnabled()) log.debug("executing " + job);
- if (job.execute(jbpmContext)) jobSession.deleteJob(job);
- }
- catch (Exception e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- jbpmContext.close();
- }
- }
-
- private void saveJobException(Exception exception) {
- // if this is a locking exception, keep it quiet
- if (DbPersistenceService.isLockingException(exception)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
- .error("failed to execute " + job, exception);
- }
- else {
- log.error("failed to execute " + job, exception);
- }
-
- boolean debug = log.isDebugEnabled();
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- // do not reattach existing job as it contains undesired updates
- JobSession jobSession = jbpmContext.getJobSession();
- Job job = jobSession.loadJob(this.job.getId());
-
- // print and save exception
- StringWriter out = new StringWriter();
- exception.printStackTrace(new PrintWriter(out));
- job.setException(out.toString());
-
- // unlock job so it can be dispatched again
- job.setLockOwner(null);
- // notify job executor
- synchronized (jobExecutor) {
- jobExecutor.notify();
- }
- }
- catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
- if (debug) log.debug("failed to save job exception", e);
- }
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- try {
- jbpmContext.close();
- }
- catch (RuntimeException e) {
- if (debug) log.debug("failed to save job exception", e);
- }
- }
- }
-
- public String toString() {
- return "JobParcel(" + job + ')';
- }
-}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -13,12 +13,12 @@
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
-public class LockMonitorThread extends Thread {
+public class LockMonitorThread extends Thread implements Deactivable {
public static final String DEFAULT_NAME = "Monitor";
private final JobExecutor jobExecutor;
- private volatile boolean isActive = true;
+ private volatile boolean active = true;
public LockMonitorThread(JobExecutor jobExecutor) {
this(DEFAULT_NAME, jobExecutor);
@@ -30,8 +30,7 @@
}
/**
- * @deprecated As of jBPM 3.2.6, replaced by
- * {@link #LockMonitorThread(JobExecutor)}
+ * @deprecated As of jBPM 3.2.6, replaced by {@link #LockMonitorThread(JobExecutor)}
*/
public LockMonitorThread(JbpmConfiguration jbpmConfiguration, int lockMonitorInterval,
int maxLockTime, int lockBufferTime) {
@@ -39,14 +38,14 @@
}
public void run() {
- while (isActive) {
+ while (active) {
try {
unlockOverdueJobs();
}
catch (RuntimeException e) {
log.error("exception in " + getName(), e);
}
- if (isActive) {
+ if (active) {
try {
sleep(jobExecutor.getLockMonitorInterval());
}
@@ -101,13 +100,9 @@
if (isActive == false) deactivate();
}
- /**
- * Indicates that this thread should stop running. Execution will cease
- * shortly afterwards.
- */
public void deactivate() {
- if (isActive) {
- isActive = false;
+ if (active) {
+ active = false;
interrupt();
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/msg/db/DbMessageService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/msg/db/DbMessageService.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/msg/db/DbMessageService.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -23,7 +23,6 @@
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
-import org.jbpm.db.JobSession;
import org.jbpm.job.Job;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.msg.MessageService;
@@ -32,27 +31,25 @@
private static final long serialVersionUID = 1L;
- private final JobSession jobSession;
- private final JobExecutor jobExecutor;
+ private final JbpmContext jbpmContext;
private boolean hasProducedJobs;
public DbMessageService() {
- JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+ jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext == null) throw new JbpmException("no active jbpm context");
-
- jobSession = jbpmContext.getJobSession();
- jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
}
public void send(Job job) {
- jobSession.saveJob(job);
+ jbpmContext.getJobSession().saveJob(job);
hasProducedJobs = true;
}
public void close() {
// if messages were produced
- if (hasProducedJobs && jobExecutor != null) {
- // notify job executor
+ if (!hasProducedJobs) return;
+ // notify job executor
+ JobExecutor jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
+ if (jobExecutor != null) {
synchronized (jobExecutor) {
jobExecutor.notify();
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java 2010-11-10 06:38:42 UTC (rev 6810)
@@ -35,7 +35,7 @@
private static final long serialVersionUID = 1L;
private final JbpmContext jbpmContext;
- private boolean hasProducedJobs;
+ private boolean hasProducedTimers;
public DbSchedulerService() {
jbpmContext = JbpmContext.getCurrentJbpmContext();
@@ -51,7 +51,7 @@
}
jbpmContext.getJobSession().saveJob(timer);
- hasProducedJobs = true;
+ hasProducedTimers = true;
}
public void deleteTimer(Timer timer) {
@@ -67,9 +67,7 @@
}
public void close() {
- // if no timers were produced, just return
- if (!hasProducedJobs) return;
-
+ if (!hasProducedTimers) return;
// notify job executor
JobExecutor jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
if (jobExecutor != null) {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-11-09 21:05:06 UTC (rev 6809)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-11-10 06:38:42 UTC (rev 6810)
@@ -262,7 +262,7 @@
]]>
</query>
- <query name="JobSession.getFirstAcquirableJobExcludingOwned">
+ <query name="JobSession.getFirstUnownedAcquirableJob">
<![CDATA[
select job
from org.jbpm.job.Job job
@@ -311,7 +311,7 @@
]]>
</query>
- <query name="JobSession.getFirstDueJobExcludingOwned">
+ <query name="JobSession.getFirstUnownedDueJob">
<![CDATA[
select job
from org.jbpm.job.Job job
13 years, 7 months
JBoss JBPM SVN: r6809 - in jbpm3/branches/jbpm-3.2-soa/core: src/main/java/org/jbpm/db and 6 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-11-09 16:05:06 -0500 (Tue, 09 Nov 2010)
New Revision: 6809
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java
Modified:
jbpm3/branches/jbpm-3.2-soa/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/Transition.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/EqualsUtil.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/StringUtil.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/XmlException.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/SerializabilityTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
Log:
JBPM-2959 backport dispatcher thread from jBPM 4;
switch to ThreadPoolExecutor is not backwards compatible and does not restart fallen threads quickly
Modified: jbpm3/branches/jbpm-3.2-soa/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-11-09 21:05:06 UTC (rev 6809)
@@ -27,6 +27,12 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
<groupId>bsh</groupId>
<artifactId>bsh</artifactId>
<optional>true</optional>
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -212,7 +212,7 @@
/**
* Waits until all jobs are processed or a specified amount of time has elapsed. Unlike
- * {@link #processJobs(long)}, this method does not concern itself with the job executor or
+ * {@link #processJobs(long)}, this method is not concerned about the job executor or
* the jBPM context.
*/
protected void waitForJobs(final long timeout) {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -49,11 +49,16 @@
public Job getFirstAcquirableJob(String lockOwner) {
try {
- return (Job) session.getNamedQuery("JobSession.getFirstAcquirableJob")
- .setString("lockOwner", lockOwner)
- .setTimestamp("now", new Date())
- .setMaxResults(1)
- .uniqueResult();
+ Query query;
+ if (lockOwner != null) {
+ query = session.getNamedQuery("JobSession.getFirstAcquirableJob")
+ .setString("lockOwner", lockOwner);
+ }
+ else {
+ query = session.getNamedQuery("JobSession.getFirstAcquirableJobExcludingOwned");
+ }
+
+ return (Job) query.setTimestamp("now", new Date()).setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not get first acquirable job", e);
@@ -88,14 +93,20 @@
public Job getFirstDueJob(String lockOwner, Collection monitoredJobs) {
try {
Query query;
- if (monitoredJobs == null || monitoredJobs.isEmpty()) {
- query = session.getNamedQuery("JobSession.getFirstDueJob");
+ if (lockOwner == null) {
+ query = session.getNamedQuery("JobSession.getFirstDueJobExcludingOwned");
}
+ else if (monitoredJobs == null || monitoredJobs.isEmpty()) {
+ query = session.getNamedQuery("JobSession.getFirstDueJob")
+ .setString("lockOwner", lockOwner);
+ }
else {
- query = session.getNamedQuery("JobSession.getFirstDueJobExcludingMonitoredJobs");
- query.setParameterList("monitoredJobIds", monitoredJobs);
+ query = session.getNamedQuery("JobSession.getFirstDueJobExcludingMonitoredJobs")
+ .setString("lockOwner", lockOwner)
+ .setParameterList("monitoredJobIds", monitoredJobs);
}
- return (Job) query.setString("lockOwner", lockOwner).setMaxResults(1).uniqueResult();
+
+ return (Job) query.setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not get first due job owned by '" + lockOwner
@@ -109,10 +120,8 @@
if (job instanceof Timer) {
Timer timer = (Timer) job;
Action action = timer.getAction();
- if (action != null && action.getId() == 0) {
- // transient action, save it
- session.save(action);
- }
+ // if action is transient, save it
+ if (action != null && action.getId() == 0L) session.save(action);
}
}
catch (HibernateException e) {
@@ -255,8 +264,8 @@
.list();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find jobs with lock time over " +
- threshold, e);
+ throw new JbpmPersistenceException("could not find jobs with lock time over " + threshold,
+ e);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/Transition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/Transition.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/def/Transition.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -128,8 +128,7 @@
*/
public void take(ExecutionContext executionContext) {
if (condition != null && isConditionEnforced) {
- Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(condition, executionContext,
- Boolean.class);
+ Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(condition, executionContext, Boolean.class);
if (!Boolean.TRUE.equals(result)) {
throw new JbpmException("condition '" + condition + "' guarding " + this + " not met");
}
@@ -140,7 +139,8 @@
token.setNode(null);
// start the transition log
- TransitionLog transitionLog = new TransitionLog(this, executionContext.getTransitionSource());
+ TransitionLog transitionLog = new TransitionLog(this,
+ executionContext.getTransitionSource());
token.startCompositeLog(transitionLog);
try {
// fire leave events for superstates (if any)
@@ -248,6 +248,12 @@
return result;
}
+ public String toString() {
+ return "Transition("
+ + (name != null ? name + ')' : (from != null && to != null) ? from + "->" + to
+ : id != 0 ? id + ")" : '@' + Integer.toHexString(hashCode()));
+ }
+
// other
// ///////////////////////////////////////////////////////////////////////////
Added: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -0,0 +1,205 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.job.executor;
+
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.job.Job;
+
+/**
+ * Thread responsible for acquiring jobs and then dispatching them to one of the threads in the
+ * job executor thread pool.
+ *
+ * @author Alejandro Guizar
+ */
+class DispatcherThread extends Thread {
+
+ private static final Log log = LogFactory.getLog(DispatcherThread.class);
+
+ public static final String DEFAULT_NAME = "Dispatcher";
+
+ private JobExecutor jobExecutor;
+ private volatile boolean active = true;
+
+ DispatcherThread(JobExecutor jobExecutor) {
+ this(DEFAULT_NAME, jobExecutor);
+ }
+
+ DispatcherThread(String name, JobExecutor jobExecutor) {
+ super(name);
+ this.jobExecutor = jobExecutor;
+ }
+
+ public void run() {
+ int retryInterval = jobExecutor.getRetryInterval();
+ while (active) {
+ // acquire job; on exception, call returns null
+ Job job = acquireJob();
+ // submit job
+ if (job != null) submitJob(job);
+
+ // if still active wait for next job
+ if (active) {
+ try {
+ if (job != null) {
+ // reset the current retry interval
+ retryInterval = jobExecutor.getRetryInterval();
+ // wait for next due job
+ long waitPeriod = getWaitPeriod(jobExecutor.getIdleInterval());
+ if (waitPeriod > 0) {
+ synchronized (jobExecutor) {
+ jobExecutor.wait(waitPeriod);
+ }
+ }
+ }
+ else {
+ // sleep instead of waiting on jobExecutor
+ // to prevent DbMessageService from waking up this thread
+ sleep(retryInterval);
+ // after an exception, double the current retry interval
+ // to avoid continuous failures during anomalous conditions
+ retryInterval *= 2;
+ // enforce maximum idle interval
+ int maxIdleInterval = jobExecutor.getMaxIdleInterval();
+ if (retryInterval > maxIdleInterval || retryInterval < 0) {
+ retryInterval = maxIdleInterval;
+ }
+ }
+ }
+ catch (InterruptedException e) {
+ if (log.isDebugEnabled()) log.debug(getName() + " got interrupted");
+ }
+ }
+ }
+ log.info(getName() + " leaves cyberspace");
+ }
+
+ private Job acquireJob() {
+ boolean debug = log.isDebugEnabled();
+ Job job;
+ // acquire job executor's monitor before creating context and allocating resources
+ synchronized (jobExecutor) {
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ // look for available job
+ job = jbpmContext.getJobSession().getFirstAcquirableJob(null);
+ // is there a job?
+ if (job != null) {
+ // lock job
+ job.setLockOwner(getName());
+ job.setLockTime(new Date());
+ // has job failed previously?
+ if (job.getException() != null) {
+ // decrease retry count
+ int retries = job.getRetries() - 1;
+ job.setRetries(retries);
+ if (debug) log.debug(job + " has " + retries + " retries remaining");
+ }
+ if (debug) log.debug("acquired " + job);
+ }
+ else if (debug) log.debug("no acquirable job found");
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ job = null;
+ if (debug) log.debug("failed to acquire job", e);
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
+ catch (RuntimeException e) {
+ job = null;
+ if (debug) log.debug("failed to acquire job", e);
+ }
+ }
+ }
+ return job;
+ }
+
+ private void submitJob(Job job) {
+ JobParcel jobParcel = new JobParcel(jobExecutor, job);
+ jobExecutor.getExecutorService().execute(jobParcel);
+ if (log.isDebugEnabled()) log.debug("submitted " + job);
+ }
+
+ private long getWaitPeriod(int currentIdleInterval) {
+ Date nextDueDate = getNextDueDate();
+ if (nextDueDate != null) {
+ long waitPeriod = nextDueDate.getTime() - System.currentTimeMillis();
+ if (waitPeriod < currentIdleInterval) return waitPeriod;
+ }
+ return currentIdleInterval;
+ }
+
+ private Date getNextDueDate() {
+ Date nextDueDate;
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ Job job = jbpmContext.getJobSession().getFirstDueJob(null, null);
+ if (job != null) {
+ nextDueDate = job.getDueDate();
+ }
+ else {
+ nextDueDate = null;
+ if (log.isDebugEnabled()) log.debug("no due job found");
+ }
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ nextDueDate = null;
+ if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
+ catch (RuntimeException e) {
+ nextDueDate = null;
+ if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
+ }
+ }
+ return nextDueDate;
+ }
+
+ /**
+ * Indicates that this thread should stop running. Execution will cease shortly afterwards.
+ */
+ public void deactivate() {
+ if (active) {
+ active = false;
+ interrupt();
+ }
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -8,7 +8,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -18,6 +17,14 @@
import org.jbpm.JbpmConfiguration;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
+import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException;
+import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler;
+import edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue;
+import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory;
+import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+
public class JobExecutor implements Serializable {
private static final long serialVersionUID = 1L;
@@ -36,10 +43,13 @@
/** @deprecated property has no effect */
protected int lockBufferTime;
- private ThreadGroup threadGroup;
+ ThreadGroup threadGroup;
+ private ExecutorService executorService;
+
/** @deprecated call {@link #getThreads()} instead */
protected Map threads;
- /** @deprecated call {@link #getThreads()} instead */
+
+ private DispatcherThread dispatcherThread;
protected LockMonitorThread lockMonitorThread;
protected Map monitoredJobIds = new Hashtable();
@@ -55,8 +65,8 @@
// create thread group
threadGroup = new ThreadGroup(name) {
public void uncaughtException(Thread thread, Throwable throwable) {
- if (thread instanceof JobExecutorThread) {
- startThread(thread.getName());
+ if (thread instanceof DispatcherThread) {
+ startDispatcherThread();
}
else if (thread instanceof LockMonitorThread) {
startLockMonitorThread();
@@ -65,11 +75,28 @@
}
};
- // start executor threads
- for (int i = 0; i < nbrOfThreads; i++) {
- startThread();
- }
+ // create thread factory
+ ThreadFactory threadFactory = new ThreadFactory() {
+ public Thread newThread(Runnable task) {
+ Thread thread = new Thread(threadGroup, task, getNextThreadName());
+ if (thread.isDaemon()) thread.setDaemon(false);
+ if (thread.getPriority() != Thread.NORM_PRIORITY)
+ thread.setPriority(Thread.NORM_PRIORITY);
+ return thread;
+ }
+ };
+ // start executor service
+ executorService = new ThreadPoolExecutor(nbrOfThreads,
+ nbrOfThreads,
+ 0L,
+ TimeUnit.MILLISECONDS,
+ new SynchronousQueue(),
+ threadFactory,
+ JobRejectionHandler.INSTANCE);
+
+ // start helper threads
+ startDispatcherThread();
startLockMonitorThread();
isStarted = true;
}
@@ -78,10 +105,24 @@
}
}
+ private static class JobRejectionHandler implements RejectedExecutionHandler {
+
+ static final JobRejectionHandler INSTANCE = new JobRejectionHandler();
+
+ public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) {
+ try {
+ executor.getQueue().put(task);
+ }
+ catch (InterruptedException e) {
+ throw new RejectedExecutionException("queuing " + task + " got interrupted", e);
+ }
+ }
+ }
+
/**
- * signals to all threads in this job executor to stop. Threads may be in the middle of
- * processing a job and they will finish that first. Use {@link #stopAndJoin()} in case you
- * want a method that blocks until all the threads are actually finished.
+ * tells all threads in this job executor to stop. Threads may be in the middle of processing
+ * a job and they will finish that first. Use {@link #stopAndJoin()} in case you want a method
+ * that blocks until all the threads are actually finished.
*
* @return a list of the stopped threads. In case no threads were stopped an empty list will
* be returned.
@@ -92,57 +133,71 @@
return Collections.EMPTY_LIST;
}
- log.info("stopping " + name);
- isStarted = false;
-
+ // list active threads
Thread[] activeThreads = new Thread[threadGroup.activeCount()];
- int threadCount = threadGroup.enumerate(activeThreads);
- for (int i = 0; i < threadCount; i++) {
- stopThread(activeThreads[i]);
- }
+ threadGroup.enumerate(activeThreads);
+ // tell threads to stop
+ stopThreads();
+
+ // return formerly active threads
return Arrays.asList(activeThreads);
}
public void stopAndJoin() throws InterruptedException {
- for (Iterator i = stop().iterator(); i.hasNext();) {
- Thread thread = (Thread) i.next();
- thread.join();
+ if (!isStarted) {
+ if (log.isDebugEnabled()) log.debug("ignoring stop, " + name + " not started");
+ return;
}
+
+ // tell threads to stop
+ stopThreads();
+
+ // wait for executor to terminate
+ executorService.awaitTermination(1, TimeUnit.MINUTES);
+
+ // join helper threads
+ dispatcherThread.join();
+ lockMonitorThread.join();
}
- public void ensureThreadsAreActive() {
- int activeCount = threadGroup.activeCount();
- if (activeCount < nbrOfThreads + 1) {
- // find out who is missing
- Thread[] activeThreads = new Thread[activeCount];
- activeCount = threadGroup.enumerate(activeThreads);
+ private void stopThreads() {
+ log.info("stopping " + name);
+ isStarted = false;
- for (int i = 1; i <= nbrOfThreads; i++) {
- String threadName = getThreadName(i);
- if (!contains(activeThreads, activeCount, threadName)) {
- // thread-i is missing, restart it
- startThread(threadName);
- }
- }
- }
+ // shut down execution service
+ executorService.shutdown();
+
+ // deactivate helper threads
+ dispatcherThread.deactivate();
+ lockMonitorThread.deactivate();
}
- private static boolean contains(Thread[] threads, int count, String threadName) {
- for (int i = 0; i < count; i++) {
- if (threadName.equals(threads[i].getName())) return true;
+ public void ensureThreadsAreActive() {
+ // executor service looks after its own threads
+ // just confirm dispatcher and lock monitor are alive
+ if (!dispatcherThread.isAlive()) {
+ startDispatcherThread();
}
- return false;
+ if (!lockMonitorThread.isAlive()) {
+ startLockMonitorThread();
+ }
}
ThreadGroup getThreadGroup() {
return threadGroup;
}
+ ExecutorService getExecutorService() {
+ return executorService;
+ }
+
+ /** @deprecated no longer invoked */
protected void startThread() {
startThread(getNextThreadName());
}
+ /** @deprecated no longer invoked */
protected void startThread(String threadName) {
Thread thread = createThread(threadName);
@@ -150,6 +205,7 @@
thread.start();
}
+ /** @deprecated no longer invoked */
protected Thread createThread(String threadName) {
return new JobExecutorThread(threadName, this);
}
@@ -158,11 +214,12 @@
return getThreadName(threadGroup.activeCount() + 1);
}
+ /** @deprecated no longer invoked */
protected String getLastThreadName() {
return getThreadName(threadGroup.activeCount());
}
- /** @deprecated */
+ /** @deprecated no longer invoked */
protected synchronized Thread stopThread() {
String threadName = getLastThreadName();
if (log.isDebugEnabled()) log.debug("stopping " + threadName);
@@ -187,18 +244,22 @@
return name + '@' + getHostAddress() + ":Executor-" + index;
}
+ void startDispatcherThread() {
+ String threadName = name + '@' + getHostAddress() + ':' + DispatcherThread.DEFAULT_NAME;
+ dispatcherThread = new DispatcherThread(threadName, this);
+
+ if (log.isDebugEnabled()) log.debug("starting " + threadName);
+ dispatcherThread.start();
+ }
+
void startLockMonitorThread() {
- String threadName = getLockMonitorThreadName();
- Thread lockMonitorThread = new LockMonitorThread(threadName, this);
+ String threadName = name + '@' + getHostAddress() + ':' + LockMonitorThread.DEFAULT_NAME;
+ lockMonitorThread = new LockMonitorThread(threadName, this);
if (log.isDebugEnabled()) log.debug("starting " + threadName);
lockMonitorThread.start();
}
- private String getLockMonitorThreadName() {
- return name + '@' + getHostAddress() + ':' + LockMonitorThread.DEFAULT_NAME;
- }
-
private static String getHostAddress() {
try {
return InetAddress.getLocalHost().getHostAddress();
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -175,11 +175,9 @@
job = jobSession.getFirstAcquirableJob(lockOwner);
// is there a job?
if (job != null) {
- // acquire jobs
- Date lockTime = new Date();
// lock job
job.setLockOwner(lockOwner);
- job.setLockTime(lockTime);
+ job.setLockTime(new Date());
// has job failed previously?
if (job.getException() != null) {
// decrease retry count
Added: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.job.executor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.db.JobSession;
+import org.jbpm.job.Job;
+import org.jbpm.persistence.db.DbPersistenceService;
+import org.jbpm.persistence.db.StaleObjectLogConfigurer;
+
+/**
+ * @author Alejandro Guizar
+ */
+class JobParcel implements Runnable {
+
+ private static final Log log = LogFactory.getLog(JobParcel.class);
+
+ private final JobExecutor jobExecutor;
+ private final Job job;
+
+ JobParcel(JobExecutor jobExecutor, Job job) {
+ this.jobExecutor = jobExecutor;
+ this.job = job;
+ }
+
+ public void run() {
+ try {
+ executeJob();
+ }
+ catch (Exception e) {
+ // on exception, call returns normally
+ saveJobException(e);
+ }
+ }
+
+ private void executeJob() throws Exception {
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ if (job.isExclusive()) {
+ jbpmContext.getGraphSession().lockProcessInstance(job.getProcessInstance());
+ }
+
+ JobSession jobSession = jbpmContext.getJobSession();
+ jobSession.reattachJob(job);
+
+ // register process instance for automatic save
+ // https://jira.jboss.org/browse/JBPM-1015
+ jbpmContext.addAutoSaveProcessInstance(job.getProcessInstance());
+
+ if (log.isDebugEnabled()) log.debug("executing " + job);
+ if (job.execute(jbpmContext)) jobSession.deleteJob(job);
+ }
+ catch (Exception e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+
+ private void saveJobException(Exception exception) {
+ // if this is a locking exception, keep it quiet
+ if (DbPersistenceService.isLockingException(exception)) {
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
+ .error("failed to execute " + job, exception);
+ }
+ else {
+ log.error("failed to execute " + job, exception);
+ }
+
+ boolean debug = log.isDebugEnabled();
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
+ try {
+ // do not reattach existing job as it contains undesired updates
+ JobSession jobSession = jbpmContext.getJobSession();
+ Job job = jobSession.loadJob(this.job.getId());
+
+ // print and save exception
+ StringWriter out = new StringWriter();
+ exception.printStackTrace(new PrintWriter(out));
+ job.setException(out.toString());
+
+ // unlock job so it can be dispatched again
+ job.setLockOwner(null);
+ // notify job executor
+ synchronized (jobExecutor) {
+ jobExecutor.notify();
+ }
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ if (debug) log.debug("failed to save job exception", e);
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally {
+ try {
+ jbpmContext.close();
+ }
+ catch (RuntimeException e) {
+ if (debug) log.debug("failed to save job exception", e);
+ }
+ }
+ }
+
+ public String toString() {
+ return "JobParcel(" + job + ')';
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobParcel.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -34,7 +34,7 @@
* manner.
*
* @author Alejandro Guizar
- * @deprecated no use for this class
+ * @deprecated not in use anymore
*/
public class CustomLoaderObjectInputStream extends ObjectInputStream {
@@ -73,7 +73,8 @@
* security-sensitive methods; note that this class does <em>not</em>
* override said methods
*/
- public CustomLoaderObjectInputStream(InputStream in, ClassLoader customLoader) throws IOException {
+ public CustomLoaderObjectInputStream(InputStream in, ClassLoader customLoader)
+ throws IOException {
super(in);
if (customLoader == null) {
throw new IllegalArgumentException("custom class loader is null");
@@ -88,7 +89,8 @@
return customLoader;
}
- protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ protected Class resolveClass(ObjectStreamClass desc) throws IOException,
+ ClassNotFoundException {
try {
return super.resolveClass(desc);
}
@@ -97,7 +99,8 @@
}
}
- protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
+ protected Class resolveProxyClass(String[] interfaces) throws IOException,
+ ClassNotFoundException {
try {
return super.resolveProxyClass(interfaces);
}
@@ -119,11 +122,11 @@
}
try {
return Proxy.getProxyClass(nonPublicLoader != null ? nonPublicLoader : customLoader,
- classes);
+ classes);
}
catch (IllegalArgumentException iae) {
throw new ClassNotFoundException("could not get proxy class for interfaces: "
- + ArrayUtil.toString(classes), e);
+ + ArrayUtil.toString(classes), e);
}
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/EqualsUtil.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -23,6 +23,7 @@
import org.hibernate.proxy.HibernateProxy;
+/** @deprecated not in use anymore */
public class EqualsUtil {
private EqualsUtil() {
@@ -32,12 +33,14 @@
/**
* hack to support comparing hibernate proxies against the real objects.
* since it falls back to ==, clients don't need to override hashcode.
+ *
* @deprecated hack does not work
* @see <a href="https://jira.jboss.org/jira/browse/JBPM-2489">JBPM-2489</a>
*/
public static boolean equals(Object thisObject, Object otherObject) {
- return thisObject == otherObject || otherObject instanceof HibernateProxy
- && otherObject.equals(thisObject);
+ return thisObject == otherObject
+ || otherObject instanceof HibernateProxy
+ && otherObject.equals(thisObject);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/StringUtil.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/StringUtil.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/StringUtil.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -3,12 +3,16 @@
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
+/** @deprecated not in use anymore */
public class StringUtil implements Serializable {
private static final long serialVersionUID = 1L;
- static final byte[] HEX_CHAR_TABLE = { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',
- (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' };
+ static final byte[] HEX_CHAR_TABLE = {
+ (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6',
+ (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd',
+ (byte) 'e', (byte) 'f'
+ };
private StringUtil() {
// hide default constructor to prevent instantiation
@@ -19,27 +23,27 @@
byte[] hex = new byte[2 * bytes.length];
int index = 0;
- for (int i=0; i<bytes.length; i++) {
+ for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
int v = b & 0xFF;
hex[index++] = HEX_CHAR_TABLE[v >>> 4];
hex[index++] = HEX_CHAR_TABLE[v & 0xF];
}
return new String(hex, "US-ASCII");
- } catch (UnsupportedEncodingException e) {
+ }
+ catch (UnsupportedEncodingException e) {
// should not happen, US-ASCII is a standard charset
throw new AssertionError(e);
}
}
-
+
public static String toHexStringHibernate(byte[] bytes) {
StringBuffer buf = new StringBuffer();
- for ( int i=0; i<bytes.length; i++ ) {
- String hexStr = Integer.toHexString( bytes[i] - Byte.MIN_VALUE );
- if ( hexStr.length()==1 ) buf.append('0');
- buf.append(hexStr);
+ for (int i = 0; i < bytes.length; i++) {
+ String hexStr = Integer.toHexString(bytes[i] - Byte.MIN_VALUE);
+ if (hexStr.length() == 1) buf.append('0');
+ buf.append(hexStr);
}
return buf.toString();
}
-
}
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/XmlException.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/XmlException.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/util/XmlException.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -24,7 +24,9 @@
import org.jbpm.JbpmException;
public class XmlException extends JbpmException {
+
private static final long serialVersionUID = 1L;
+
public XmlException(String message, Throwable cause) {
super(message, cause);
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-11-09 21:05:06 UTC (rev 6809)
@@ -262,6 +262,18 @@
]]>
</query>
+ <query name="JobSession.getFirstAcquirableJobExcludingOwned">
+ <![CDATA[
+ select job
+ from org.jbpm.job.Job job
+ where job.lockOwner is null
+ and job.retries > 0
+ and job.dueDate <= :now
+ and job.isSuspended = false
+ order by job.dueDate asc
+ ]]>
+ </query>
+
<query name="JobSession.findExclusiveJobs">
<![CDATA[
select job
@@ -299,6 +311,17 @@
]]>
</query>
+ <query name="JobSession.getFirstDueJobExcludingOwned">
+ <![CDATA[
+ select job
+ from org.jbpm.job.Job job
+ where job.lockOwner is null
+ and job.retries > 0
+ and job.isSuspended = false
+ order by job.dueDate asc
+ ]]>
+ </query>
+
<query name="JobSession.suspendJobs">
<![CDATA[
update org.jbpm.job.Job job
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/SerializabilityTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/SerializabilityTest.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/SerializabilityTest.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -65,7 +65,10 @@
"org.jbpm.instantiation.FieldInstantiator",
"org.jbpm.instantiation.ProcessClassLoader",
"org.jbpm.instantiation.XmlInstantiator",
+ "org.jbpm.job.executor.DispatcherThread",
"org.jbpm.job.executor.JobExecutorThread",
+ "org.jbpm.job.executor.JobExecutor$JobRejectionHandler",
+ "org.jbpm.job.executor.JobParcel",
"org.jbpm.job.executor.LockMonitorThread",
"org.jbpm.jpdl.convert.Converter",
"org.jbpm.jpdl.el.",
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java 2010-11-09 16:42:36 UTC (rev 6808)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java 2010-11-09 21:05:06 UTC (rev 6809)
@@ -48,14 +48,13 @@
deployProcessDefinition(processDefinition);
}
- // check if the process ends correctly if no Error is thrown
+ /** check if the process ends correctly if no Error is thrown */
public void testTimerWithoutErrorAction() {
throwError = false;
runTimerErrorAction();
}
- // check if the process ends correctly if an Error is thrown in the
- // ActionHandler
+ /** check if the process ends correctly if an Error is thrown in the ActionHandler */
public void testTimerWithErrorAction() {
throwError = true;
runTimerErrorAction();
@@ -67,9 +66,8 @@
processInstance.signal();
processJobs();
-
processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
- assert processInstance.hasEnded() : processInstance;
+ assert processInstance.hasEnded() : "expected " + processInstance + " to have ended";
}
public static class TimerExceptionAction implements ActionHandler {
13 years, 7 months