Package com.iizix.txp
Interface ITXProcess
- All Known Implementing Classes:
- TXProcessImpl
public interface ITXProcess
The 
TXPProcess interface abstracts a transactional process. The interface is used by nodes. Coordinator and process implementations may use proprietary interfaces to communicate with each other.- Author:
- Freggle
- Nested Class SummaryNested Classes
- Method SummaryModifier and TypeMethodDescription- void- addAttribute- (String name, Object value) Adds a named attribute.- voidAssociate an atomic unit of work (a node) with this process.- void- commit()Called by the process logic/application (not the nodes!)to request that the transactional process gets committed.- getAttribute- (String name) Gets a named attribute.Return the process local policy- getPid()Gets the pid of his process- longGets the remaining time before timeout.- getState()Get the state of this process.- longReturns the nr of milliseconds this process waits for all nodes.- void- ready- (ITXPNode node, ITXPNode.State nodeState) A node will call this method to signal its state after attempting to do the work.- removeAttribute- (String name) Removes a named attribute.- void- rollback()Called by the process logic/application (not the nodes) to request that the transactional process rolls back the work.- void- setStartTimeout- (long timeout) Tells the process to wait timeout ms for the work to be done.- voidCalled by a node indicating it timed out waiting on the process.- void- useLocalPolicy- (ITXPPolicy policy) Have the coordinator use the specified local policy for this process.
- Method Details- useLocalPolicyHave the coordinator use the specified local policy for this process. To stop using a local policy specify- null.- Parameters:
- policy- the policy
 
- getLocalPolicyITXPPolicy getLocalPolicy()Return the process local policy- Returns:
- the process local policy or null if none is used
 
- getPidITXPid getPid()Gets the pid of his process- Returns:
- the pid
 
- getTimeoutlong getTimeout()Returns the nr of milliseconds this process waits for all nodes. The timeout is applied when setStartTimeout() is called on the process. It is up to the coordinator (and maybe policy) to decide how to deal with a timeout but the nodes needs to be signalled that the process timed out and the defined behaviour for the node is to stop the work and wait for rollback unless the coordinator decides to CONTINUE or IGNORE the timeout.- Returns:
- the timeout time in milliseconds
 
- associateAssociate an atomic unit of work (a node) with this process. This will cause a- begin()call in the node.- Parameters:
- node- the node
 
- setStartTimeoutvoid setStartTimeout- (long timeout) Tells the process to wait timeout ms for the work to be done.- Parameters:
- timeout- Timeout in milliseconds.
 
- getRemainingTimelong getRemainingTime()Gets the remaining time before timeout. This value just keeps on counting, even when the timeout has occurred or the task is stopped.- Returns:
- A time in milliseconds >= zero indicating the remaining timeout time, or < zero if the task has timed out. The return value is Long.MAX_VALUEif the timeout is indefinite or never set.
 
- getStateITXProcess.State getState()Get the state of this process.- Returns:
- the state
 
- readyA node will call this method to signal its state after attempting to do the work.- Parameters:
- node- the node
- nodeState- the current state of the node
 
- timeoutCalled by a node indicating it timed out waiting on the process. The process (and coordinator) must assume that the node abandoned the process and rolled back any change they made on behalf of it.- Parameters:
- node- the node
 
- commitCalled by the process logic/application (not the nodes!)to request that the transactional process gets committed.- Throws:
- TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
 
- rollbackCalled by the process logic/application (not the nodes) to request that the transactional process rolls back the work.- Throws:
- TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
 
- addAttributeAdds a named attribute.- Parameters:
- name- the attribute name
- value- the attribute value
 
- getAttributeGets a named attribute.- Parameters:
- name- the attribute name
- Returns:
- the attribute value
 
- removeAttributeRemoves a named attribute.- Parameters:
- name- the attribute name
- Returns:
- the attribute value