Ejemplo n.º 1
0
 public boolean isTransacted() {
   UnitOfWork uow = getUnitOfWork();
   if (uow != null) {
     return uow.isTransacted();
   } else {
     return false;
   }
 }
Ejemplo n.º 2
0
 public boolean containsOnCompletion(Synchronization onCompletion) {
   if (unitOfWork != null) {
     // if there is an unit of work then the completions is moved there
     return unitOfWork.containsSynchronization(onCompletion);
   } else {
     // check temporary completions if no unit of work yet
     return onCompletions != null && onCompletions.contains(onCompletion);
   }
 }
Ejemplo n.º 3
0
 public void handoverCompletions(Exchange target) {
   if (onCompletions != null) {
     for (Synchronization onCompletion : onCompletions) {
       target.addOnCompletion(onCompletion);
     }
     // cleanup the temporary on completion list as they have been handed over
     onCompletions.clear();
     onCompletions = null;
   } else if (unitOfWork != null) {
     // let unit of work handover
     unitOfWork.handoverSynchronization(target);
   }
 }
Ejemplo n.º 4
0
 public void setUnitOfWork(UnitOfWork unitOfWork) {
   this.unitOfWork = unitOfWork;
   if (unitOfWork != null && onCompletions != null) {
     // now an unit of work has been assigned so add the on completions
     // we might have registered already
     for (Synchronization onCompletion : onCompletions) {
       unitOfWork.addSynchronization(onCompletion);
     }
     // cleanup the temporary on completion list as they now have been registered
     // on the unit of work
     onCompletions.clear();
     onCompletions = null;
   }
 }
Ejemplo n.º 5
0
 /**
  * If the consumer needs to defer done the {@link org.apache.camel.spi.UnitOfWork} on the
  * processed {@link Exchange} then this method should be use to create and start the {@link
  * UnitOfWork} on the exchange.
  *
  * @param exchange the exchange
  * @return the created and started unit of work
  * @throws Exception is thrown if error starting the unit of work
  * @see #doneUoW(org.apache.camel.Exchange)
  */
 public UnitOfWork createUoW(Exchange exchange) throws Exception {
   UnitOfWork uow = UnitOfWorkHelper.createUoW(exchange);
   exchange.setUnitOfWork(uow);
   uow.start();
   return uow;
 }