Class AgentReservationSessionEJB

  • All Implemented Interfaces:
    AgentReservationSession, AgentReservationSessionLocal, AgentReservationSessionRemote, SessionSynchronization

    public class AgentReservationSessionEJB
    extends Object
    implements AgentReservationSessionLocal, AgentReservationSessionRemote, SessionSynchronization
    This class provides an example of a Stateful session bean that will try to coordinate its local transaction with the tranaction of a remote session bean. The actual configuration may not really proove anything since the two applications will probably be deployed to the same server. We would need to break them apart into separate servers and separate server implementations to show anything really significant.

    Note too that this session bean declares its transaction properties using class annotations. By default, this stateful session bean runs without a tranaction while caching reservations for the user. A transaction is required only for the commit() call, which also signals the removal of this bean instance.

    The bean also implements the javax.ejb.SessionSynchronization interface. This allows it to be called at the start and end of a transaction so that it has a chance to update its cached values appropriately. This bean, however, just prints some debug.