org.apache.camel.impl
Class DefaultUnitOfWork

java.lang.Object
  extended by org.apache.camel.impl.DefaultUnitOfWork
All Implemented Interfaces:
Service, TraceableUnitOfWork, UnitOfWork

public class DefaultUnitOfWork
extends Object
implements TraceableUnitOfWork, Service

The default implementation of UnitOfWork

Version:
$Revision: 780261 $

Constructor Summary
DefaultUnitOfWork(Exchange exchange)
           
 
Method Summary
 void addInterceptedNode(ProcessorDefinition node)
          Adds the given node that was intercepted
 void addSynchronization(Synchronization synchronization)
          Adds a synchronization hook
 void done(Exchange exchange)
          Invoked when this unit of work has been completed, whether it has failed or completed
 String getId()
          Returns the unique ID of this unit of work, lazily creating one if it does not yet have one
 List<ProcessorDefinition> getInterceptedNodes()
          Gets the current list of intercepted nodes, representing the route path the current Exchange has taken.
 ProcessorDefinition getLastInterceptedNode()
          Gets the last intercepted node, is null if no last exists.
 Object getOriginalInBody()
          Gets the original IN body this Unit of Work was started with.
 void handoverSynchronization(Exchange target)
          Handover all the registered synchronizations to the target Exchange.
 void removeSynchronization(Synchronization synchronization)
          Removes a synchronization hook
 void start()
          Starts the service
 void stop()
          Stops the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUnitOfWork

public DefaultUnitOfWork(Exchange exchange)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Throws:
Exception

addSynchronization

public void addSynchronization(Synchronization synchronization)
Description copied from interface: UnitOfWork
Adds a synchronization hook

Specified by:
addSynchronization in interface UnitOfWork
Parameters:
synchronization - the hook

removeSynchronization

public void removeSynchronization(Synchronization synchronization)
Description copied from interface: UnitOfWork
Removes a synchronization hook

Specified by:
removeSynchronization in interface UnitOfWork
Parameters:
synchronization - the hook

handoverSynchronization

public void handoverSynchronization(Exchange target)
Description copied from interface: UnitOfWork
Handover all the registered synchronizations to the target Exchange.

This is used when a route turns into asynchronous and the Exchange that is continued and routed in the async thread should do the on completion callbacks instead of the original synchronous thread.

Specified by:
handoverSynchronization in interface UnitOfWork
Parameters:
target - the target exchange

done

public void done(Exchange exchange)
Description copied from interface: UnitOfWork
Invoked when this unit of work has been completed, whether it has failed or completed

Specified by:
done in interface UnitOfWork
Parameters:
exchange - the current exchange

getId

public String getId()
Description copied from interface: UnitOfWork
Returns the unique ID of this unit of work, lazily creating one if it does not yet have one

Specified by:
getId in interface UnitOfWork
Returns:
the unique ID

addInterceptedNode

public void addInterceptedNode(ProcessorDefinition node)
Description copied from interface: TraceableUnitOfWork
Adds the given node that was intercepted

Specified by:
addInterceptedNode in interface TraceableUnitOfWork
Parameters:
node - the node

getLastInterceptedNode

public ProcessorDefinition getLastInterceptedNode()
Description copied from interface: TraceableUnitOfWork
Gets the last intercepted node, is null if no last exists.

Specified by:
getLastInterceptedNode in interface TraceableUnitOfWork

getInterceptedNodes

public List<ProcessorDefinition> getInterceptedNodes()
Description copied from interface: TraceableUnitOfWork
Gets the current list of intercepted nodes, representing the route path the current Exchange has taken.

Specified by:
getInterceptedNodes in interface TraceableUnitOfWork

getOriginalInBody

public Object getOriginalInBody()
Description copied from interface: UnitOfWork
Gets the original IN body this Unit of Work was started with.

Specified by:
getOriginalInBody in interface UnitOfWork
Returns:
the original IN body


Copyright © 2009 Apache Software Foundation. All Rights Reserved.