Class AbstractTXPNode

    • Field Detail

      • pid

        protected ITXPid pid
        The Pid
      • process

        protected ITXProcess process
        The process this node is associated with
      • timeout

        protected long timeout
        The timeout value for this node (default indefinite)
      • hasTimedOutWaiting

        protected volatile boolean hasTimedOutWaiting
      • hasTimedOut

        protected volatile boolean hasTimedOut
      • hasProcessTimedOut

        protected volatile boolean hasProcessTimedOut
    • Constructor Detail

      • AbstractTXPNode

        public AbstractTXPNode()
    • Method Detail

      • getPid

        public ITXPid getPid()
        Description copied from interface: ITXPNode
        Gets the pid of this node.
        Specified by:
        getPid in interface ITXPNode
        Returns:
        the pid
      • isIdempotent

        public boolean isIdempotent()
        Description copied from interface: ITXPNode
        Asks if the node is idempotent. Idempotent means f(f(x)) = f(x). For instance: if the node turns on a light, turning it on again has the same result: the light is on.
        Specified by:
        isIdempotent in interface ITXPNode
        Returns:
        true if this node is idempotent, false if not
      • getTimeout

        public long getTimeout()
        Description copied from interface: ITXPNode
        Gets the time in milliseconds this node will wait for a commit() or rollback() call after it is ready.
        Specified by:
        getTimeout in interface ITXPNode
        Returns:
        the timeout in milliseconds
      • setTimeout

        public void setTimeout​(long t)
      • undo

        public ITXPNode.State undo​(ITXProcess process)
        Description copied from interface: ITXPNode
        Instructs the node to undo the committed work. The node should set and respond with either ITXPNode.State.OK, ITXPNode.State.FAILED or ITXPNode.State.UNABLE depending on its state. This is of course the 'crux'. It is the implementation that may or may not be able to undo something. For instance. if the node is a JDBC transaction it may know how to perform a compensating transaction; or not.
        Specified by:
        undo in interface ITXPNode
        Parameters:
        process - the process
        Returns:
        the state of the node
      • recover

        public ITXPNode.State recover​(ITXProcess process)
        Description copied from interface: ITXPNode
        This method instructs an node to recover a process after some sort of system failure. In effect this means restoring the state of the ITXPNode to the last known state with regards to the specified process. The node should set and respond with either ITXPNode.State.OK, ITXPNode.State.FAILED or ITXPNode.State.UNABLE depending on its state. To be able to do this the node needs to log its state durably and use the Processes Pid as a key.
        Specified by:
        recover in interface ITXPNode
        Parameters:
        process - the process
        Returns:
        the state of the node
      • timeout

        public void timeout​(ITXProcess process)
        Description copied from interface: ITXPNode
        Called by a process to indicate it timed out waiting for this node. The node should abandon the work and wait for rollback or return READ_ONLY if it can.
        Specified by:
        timeout in interface ITXPNode
        Parameters:
        process - the process that timed out
      • processTimeout

        public void processTimeout​(ITXProcess process)
        Description copied from interface: ITXPNode
        Called by a process to indicate it timed out waiting for all nodes to complete the work. The node should abandon the work if it can and wait for rollback or return READ_ONLY if it can.
        Specified by:
        processTimeout in interface ITXPNode
        Parameters:
        process - the process that timed out
      • hasTimedOut

        public boolean hasTimedOut()
        Description copied from interface: ITXPNode
        Check if timeout has been called
        Specified by:
        hasTimedOut in interface ITXPNode
        Returns:
        true if timeout has been called
      • hasProcessTimedOut

        public boolean hasProcessTimedOut()
        Description copied from interface: ITXPNode
        Check if processTimeout has been called
        Specified by:
        hasProcessTimedOut in interface ITXPNode
        Returns:
        try if processTimeout has been called
      • getProcess

        protected ITXProcess getProcess()
        Gets the process this node is associated with.
        Returns:
        Returns the TXProcess instance.
      • ready

        protected void ready()
      • hasTimedOutWaiting

        protected boolean hasTimedOutWaiting()
      • cancelTimeout

        protected void cancelTimeout()
      • createLogger

        protected void createLogger()