[jboss-user] [JBoss jBPM] - Re: does this design make sense?

dOoMi do-not-reply at jboss.com
Fri Jul 11 05:21:58 EDT 2008


"kukeltje" wrote : anonymous wrote :  jBPM swallows the StaleObjectStateException causing the calling code not to notice that the operation failed.  Afaik, that can be configured in jBPM 3.2.3. Please have a look in the docs
  | 

i'm afraid not. i've been on this thing several hours. the configuration allows you to influence the logging but not the handling of StaleObjectStateExceptions. you can see that clearly when having a look at the source of the Services class:

public void close() {
  | 236:                if (services != null) {
  | 237:                    Map closeExceptions = new HashMap();
  | 238:                    Throwable firstException = null;
  | 239:                    Iterator iter = serviceNames.iterator();
  | 240:                    while (iter.hasNext()) {
  | 241:                        String serviceName = (String) iter.next();
  | 242:                        Service service = (Service) services.get(serviceName);
  | 243:                        if (service != null) {
  | 244:                            try {
  | 245:                                log.debug("closing service '" + serviceName
  | 246:                                        + "': " + service);
  | 247:                                service.close();
  | 248:                            } catch (JbpmPersistenceException e) {
  | 249:                                // if this is a stale object exception, the jbpm configuration has control over the logging
  | 250:                                if ("org.hibernate.StaleObjectStateException"
  | 251:                                        .equals(e.getCause().getClass()
  | 252:                                                .getName())) {
  | 253:                                    log.info("problem closing service '"
  | 254:                                            + serviceName
  | 255:                                            + "': optimistic locking failed");
  | 256:                                    StaleObjectLogConfigurer.staleObjectExceptionsLog
  | 257:                                            .error(
  | 258:                                                    "problem closing service '"
  | 259:                                                            + serviceName
  | 260:                                                            + "': optimistic locking failed",
  | 261:                                                    e);
  | 262:                                } else {
  | 263:                                    log.error("problem closing service '"
  | 264:                                            + serviceName + "'", e);
  | 265:                                }
  | 266:                            } catch (Exception e) {
  | 267:                                // NOTE that Error's are not caught because that might halt the JVM and mask the original Error.
  | 268:                                log.error("problem closing service '"
  | 269:                                        + serviceName + "'", e);
  | 270:                                closeExceptions.put(serviceName, e);
  | 271:                                if (firstException == null) {
  | 272:                                    firstException = e;
  | 273:                                }
  | 274:                            }
  | 275:                        }
  | 276:                    }
  | 277:                    if (!closeExceptions.isEmpty()) {
  | 278:                        throw new JbpmException("problem closing services "
  | 279:                                + closeExceptions, firstException);
  | 280:                    }
  | 281:                }
  | 282:            }
  | 283:
  | 284:            public static void assignId(Object object) {
  | 285:                JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
  | 286:                if (jbpmContext != null) {
  | 287:                    // give this process instance an id
  | 288:                    Services services = jbpmContext.getServices();
  | 289:                    if (services.hasService(Services.SERVICENAME_PERSISTENCE)) {
  | 290:                        PersistenceService persistenceService = services
  | 291:                                .getPersistenceService();
  | 292:                        persistenceService.assignId(object);
  | 293:                    }
  | 294:                }
  | 295:            }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163811#4163811

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163811



More information about the jboss-user mailing list