Package org.drools.persistence

Examples of org.drools.persistence.Transaction


        }
        return xaResource;
    }

    public Transaction getTransaction() {
        return new Transaction( getUniqueXID(),
                                getXAResource() );
    }
View Full Code Here


  public <T> T execute(Command<T> command) {
    Persister<StatefulSession> persister =
      new MemoryPersister<StatefulSession>(new StatefulSessionSnapshotter(getSession()));
    persister.save();
    Transaction transaction = persister.getTransaction();
    try {
      transaction.start();
      T result = super.executeNext(command);
      transaction.commit();
      return result;
    } catch (Throwable t) {
      try {
        transaction.rollback();
        throw new RuntimeException("Could not execute command", t);
      } catch (XAException e) {
        throw new RuntimeException("Could not rollback transaction", e);
      }
    }
View Full Code Here

 
  public Object execute(Command command) {
    Persister<StatefulSession> persister =
      new MemoryPersister<StatefulSession>(new StatefulSessionSnapshotter(session));
    persister.save();
    Transaction transaction = persister.getTransaction();
    try {
      transaction.start();
      Object result = command.execute(session);
      transaction.commit();
      return result;
    } catch (Throwable t) {
      try {
        transaction.rollback();
        throw new RuntimeException("Could not execute command", t);
      } catch (XAException e) {
        throw new RuntimeException("Could not rollback transaction", e);
      }
    }
View Full Code Here

TOP

Related Classes of org.drools.persistence.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.