Package org.jbpm.pvm.internal.tx

Examples of org.jbpm.pvm.internal.tx.Transaction


      job.release();
      job.setRetries(decrementedRetries);
    job.setException(sw.toString());
     
      // notify the job executor after the transaction is completed
      Transaction transaction = environment.get(Transaction.class);
      JobExecutor jobExecutor = environment.get(JobExecutor.class);
      if ( (transaction!=null)
           && (jobExecutor!=null)
         ) {
        log.trace("registering job executor notifier with "+transaction);
        transaction.registerSynchronization(new JobAddedNotification(jobExecutor));
      }
    }
    return null;
  }
View Full Code Here


  }
 
  public void handle(ExecutionImpl execution, Exception exception) {
    if (isTransactional) {
      EnvironmentImpl environment = EnvironmentImpl.getCurrent();
      Transaction transaction = (environment!=null ? environment.get(Transaction.class) : null);
      if (transaction!=null) {
        log.trace("registering exception handler to "+transaction);
        CommandService commandService = environment.get(CommandService.class);
        if (commandService==null) {
          throw new JbpmException("environment doesn't have a command service for registering transactional exception handler", exception);
View Full Code Here

    try {
      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
      ObjectInputStream ois = new ObjectInputStream(bais);
      Object object = ois.readObject();
     
      Transaction transaction = EnvironmentImpl.getFromCurrent(Transaction.class, false);
      if (transaction!=null) {
        transaction.registerDeserializedObject(new DeserializedObject(object, scopeInstance, (BlobVariable) variable));
      }
     
      return object;

    } catch (Exception e) {
View Full Code Here

      release();
     
      // notify the jobExecutor at the end of the transaction
      JobExecutor jobExecutor = environment.get(JobExecutor.class);
      if (jobExecutor!=null) {
        Transaction transaction = environment.get(Transaction.class);
        if (transaction==null) {
          throw new JbpmException("no transaction in environment");
        }
        JobAddedNotification jobNotificator = new JobAddedNotification(jobExecutor);
        transaction.registerSynchronization(jobNotificator);
      }
    }

    return deleteThisJob;
  }
View Full Code Here

  /** This transaction will be marked for rollback.  A command will be associated with the
   * Transaction.EVENT_AFTERCOMPLETION (after the job locks of the current transaction are
   * released).  Then the command will update the job with the exception details in a separate
   * transaction. */
  protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Exception exception) {
    Transaction transaction = environment.get(Transaction.class);
    CommandService commandService = (CommandService) environment.get(CommandService.NAME_NEW_TX_REQUIRED_COMMAND_SERVICE);
    JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
    transaction.registerSynchronization(jobExceptionHandler);
   
    if (exception instanceof RuntimeException) {
      throw (RuntimeException) exception;
    }
    throw new JbpmException("job failed: "+exception.getMessage(), exception);
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.tx.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.