Interface SRAApi


  • public interface SRAApi
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      SRAInfo beginTransaction​(java.lang.Long timeout, java.util.concurrent.TimeUnit unit)
      Begin a new SRA.
      SRAInfo cancelTransaction​(java.lang.String txId)
      Cancel a SRA
      SRAInfo commitTransaction​(java.lang.String txId)
      Commit a SRA
      javax.ws.rs.core.Response deleteParticipant​(java.lang.String enlistmentId)
      Performing DELETE on participant's recovery URL removes participant from the transaction.
      javax.ws.rs.core.Response enlistParticipant​(java.lang.String linkHeader, java.lang.String txId, java.lang.String content)
      Register a participant in a tx
      javax.ws.rs.core.Response enlistVolatileParticipant​(java.lang.String linkHeader, java.lang.String txId)
      Register a volatile participant in a tx
      java.util.List<SRAInfo> getAllTransactions()
      List of all transaction URIs known to the coordinator (active and in recovery)
      javax.ws.rs.core.Response getTransactionExtStatus​(java.lang.String id)
      Performing a GET on the transaction URL with media type application/txstatusext+xml returns extended information about the transaction, such as its status, number of participants, and their individual URIs.
      TransactionManagerElement getTransactionManagerInfo()
      Return extended information about the transaction-manager resource such as how long it has been up and all transaction-coordinator URIs.
      TransactionStatisticsElement getTransactionStatistics()
      Return statistics for the transaction manager: number of active, prepared, committed, and aborted transactions are returned.
      java.lang.String getTransactionStatus​(java.lang.String id)
      Get the current status for a transaction
      SRAInfo getTransactionURIs​(java.lang.String id)
      Obtain the transaction terminator and participant enlistment URIs for the specified transaction id.
      javax.ws.rs.core.Response lookupParticipant​(java.lang.String txId, java.lang.String enlistmentId)
      Get the participant url (registered during enlistParticipant) corresponding to a resource reference if the coordinator crashes - the participant list will be empty but this is ok if commit hasn't been called since the TM uses presumed abort semantics.
      javax.ws.rs.core.Response postParticipant​(java.lang.String enlistmentId)  
      javax.ws.rs.core.Response replaceParticipant​(java.lang.String linkHeader, java.lang.String txId, java.lang.String enlistmentId)
      PUT /recovery-coordinator/_RecCoordId_/_new participant URL_ - overwrite the old participant URL with new participant URL (as with JTS, this will also trigger off a recovery attempt on the associated transaction) A participant may use this url to notifiy the coordinator that he has moved to a new location.
    • Method Detail

      • getAllTransactions

        java.util.List<SRAInfo> getAllTransactions()
        List of all transaction URIs known to the coordinator (active and in recovery)
      • getTransactionManagerInfo

        TransactionManagerElement getTransactionManagerInfo()
        Return extended information about the transaction-manager resource such as how long it has been up and all transaction-coordinator URIs.
      • getTransactionStatistics

        TransactionStatisticsElement getTransactionStatistics()
        Return statistics for the transaction manager: number of active, prepared, committed, and aborted transactions are returned.
        Returns:
        TransactionStatisticsElement
      • getTransactionURIs

        SRAInfo getTransactionURIs​(java.lang.String id)
        Obtain the transaction terminator and participant enlistment URIs for the specified transaction id.
        Parameters:
        id - URL template parameter for the transaction id
        Returns:
      • getTransactionStatus

        java.lang.String getTransactionStatus​(java.lang.String id)
        Get the current status for a transaction
        Parameters:
        id - the id of the transaction
        Returns:
        content representing the status of the transaction
      • getTransactionExtStatus

        javax.ws.rs.core.Response getTransactionExtStatus​(java.lang.String id)
        Performing a GET on the transaction URL with media type application/txstatusext+xml returns extended information about the transaction, such as its status, number of participants, and their individual URIs.
        Parameters:
        id - the id of the transaction
        Returns:
        HTTP response representing extended transaction status information
      • beginTransaction

        SRAInfo beginTransaction​(java.lang.Long timeout,
                                 java.util.concurrent.TimeUnit unit)
                          throws GenericSRAException
        Begin a new SRA.
        Parameters:
        timeout - the number of milliseconds after which the transaction is eligible for being timed out.
        Returns:
        SRA info
        Throws:
        GenericSRAException
      • commitTransaction

        SRAInfo commitTransaction​(java.lang.String txId)
        Commit a SRA
        Parameters:
        txId - id of the SRA to commit
        Returns:
        SRA status
      • cancelTransaction

        SRAInfo cancelTransaction​(java.lang.String txId)
        Cancel a SRA
        Parameters:
        txId - id of the SRA to cancel
        Returns:
        SRA status
      • enlistParticipant

        javax.ws.rs.core.Response enlistParticipant​(java.lang.String linkHeader,
                                                    java.lang.String txId,
                                                    java.lang.String content)
        Register a participant in a tx
        Parameters:
        linkHeader - link header
        txId - id of transaction
        content - body of request containing URI for driving the participant through completion (the URI should be unique within the scope of txId)
        Returns:
        unique resource ref for the participant
      • enlistVolatileParticipant

        javax.ws.rs.core.Response enlistVolatileParticipant​(java.lang.String linkHeader,
                                                            java.lang.String txId)
        Register a volatile participant in a tx
        Parameters:
        linkHeader - link header
        txId - id of transaction
        Returns:
        HTTP status code
      • lookupParticipant

        javax.ws.rs.core.Response lookupParticipant​(java.lang.String txId,
                                                    java.lang.String enlistmentId)
        Get the participant url (registered during enlistParticipant) corresponding to a resource reference if the coordinator crashes - the participant list will be empty but this is ok if commit hasn't been called since the TM uses presumed abort semantics.
        Parameters:
        txId - transaction id that this recovery url belongs to
        enlistmentId - the resource reference
        Returns:
        the participant url
      • replaceParticipant

        javax.ws.rs.core.Response replaceParticipant​(java.lang.String linkHeader,
                                                     java.lang.String txId,
                                                     java.lang.String enlistmentId)
        PUT /recovery-coordinator/_RecCoordId_/_new participant URL_ - overwrite the old participant URL with new participant URL (as with JTS, this will also trigger off a recovery attempt on the associated transaction) A participant may use this url to notifiy the coordinator that he has moved to a new location.
        Parameters:
        linkHeader - link header containing participant links
        txId - transaction id that this recovery url belongs to
        enlistmentId - id by the participant is known
        Returns:
        http status code
      • postParticipant

        javax.ws.rs.core.Response postParticipant​(java.lang.String enlistmentId)
      • deleteParticipant

        javax.ws.rs.core.Response deleteParticipant​(java.lang.String enlistmentId)
        Performing DELETE on participant's recovery URL removes participant from the transaction.
        Parameters:
        enlistmentId - The resource reference
        Returns:
        HTTP status code