[jbpm-commits] JBoss JBPM SVN: r6686 - jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Sep 27 17:40:46 EDT 2010
Author: alex.guizar at jboss.com
Date: 2010-09-27 17:40:46 -0400 (Mon, 27 Sep 2010)
New Revision: 6686
Modified:
jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
Log:
JBPM-2945 if an exception is thrown during command execution, have CommandListenerBean send the exception back as the result
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java 2010-09-27 15:32:02 UTC (rev 6685)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java 2010-09-27 21:40:46 UTC (rev 6686)
@@ -105,10 +105,6 @@
@PostConstruct
void createConnection() {
- Object cs = messageDrivenContext.lookup("ejb/LocalCommandService");
- if (!(cs instanceof LocalCommandService)) {
- throw new AssertionError(cs);
- }
try {
jmsConnection = jmsConnectionFactory.createConnection();
}
@@ -134,14 +130,11 @@
// extract command from message
Command command = extractCommand(message);
if (command == null) return;
+
+ // execute command via local command executor bean
+ Object result;
try {
- // execute command via local command executor bean
- Object result = commandService.execute(command);
- // send a response back if a "reply to" destination is set
- Destination replyTo = message.getJMSReplyTo();
- if (replyTo != null && (result instanceof Serializable || result == null)) {
- sendResult((Serializable) result, replyTo, message.getJMSMessageID());
- }
+ result = commandService.execute(command);
}
catch (RuntimeException e) {
// MDBs are not supposed to throw exceptions
@@ -149,13 +142,19 @@
// if this is a locking exception, keep it quiet
if (DbPersistenceService.isLockingException(e)) {
StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("failed to execute "
- + command,
- e);
+ + command, e);
}
else {
log.error("failed to execute " + command, e);
}
+ // the exception becomes the result
+ result = e;
}
+ // send a response back if a "reply to" destination is set
+ Destination replyTo = message.getJMSReplyTo();
+ if (replyTo != null && (result instanceof Serializable || result == null)) {
+ sendResult((Serializable) result, replyTo, message.getJMSMessageID());
+ }
}
catch (JMSException e) {
messageDrivenContext.setRollbackOnly();
More information about the jbpm-commits
mailing list