AGXAResource (agraph-java-client 5.0.4-SNAPSHOT API)
Description: declaration: package: com.franz.agraph.repository, class: AGXAResource

Package com.franz.agraph.repository

# Class AGXAResource

java.lang.Object
com.franz.agraph.repository.AGXAResource

All Implemented Interfaces:
  `XAResource`

public class AGXAResource extends Object implements XAResource

- ## Field Summary

  ### Fields inherited from interface javax.transaction.xa.XAResource

  `TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AGXAResource(AGRepositoryConnection conn)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `commit(Xid xid, boolean onePhase)`
  `void`
  `end(Xid xid, int flags)`
  Disassociate the transaction (identified by xid) from the resource Ends the work performed on behalf of a transaction branch.
  `void`
  `forget(Xid xid)`
  `int`
  `getTransactionTimeout()`
  `boolean`
  `isSameRM(XAResource xares)`
  This method must return true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing.
  `int`
  `prepare(Xid xid)`
  Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
  `Xid[]`
  `recover(int flag)`
  Obtains a list of prepared transaction branches from a resource manager.
  `void`
  `rollback(Xid xid)`
  `boolean`
  `setTransactionTimeout(int seconds)`
  `void`
  `start(Xid xid, int flags)`
  Starts work on behalf of a transaction branch specified in xid.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AGXAResource

    public AGXAResource(AGRepositoryConnection conn)

- ## Method Details

  - ### start

    public void start(Xid xid, int flags) throws XAException
    Starts work on behalf of a transaction branch specified in xid. If TMJOIN is specified, the start applies to joining a transaction previously seen by the resource manager. If TMRESUME is specified, the start applies to resuming a suspended transaction specified in the parameter xid. If neither TMJOIN nor TMRESUME is specified and the transaction specified by xid has previously been seen by the resource manager, the resource manager throws the XAException exception with XAER_DUPID error code.
    Specified by:
      `start` in interface `XAResource`
    Parameters:
      `xid` - A global transaction identifier to be associated with the resource.
      `flags` - One of TMNOFLAGS, TMJOIN, or TMRESUME.
    Throws:
      `XAException`

  - ### end

    public void end(Xid xid, int flags) throws XAException
    Disassociate the transaction (identified by xid) from the resource Ends the work performed on behalf of a transaction branch. The resource manager disassociates the XA resource from the transaction branch specified and lets the transaction complete. If TMSUSPEND is specified in the flags, the transaction branch is temporarily suspended in an incomplete state. The transaction context is in a suspended state and must be resumed via the start method with TMRESUME specified. If TMFAIL is specified, the portion of work has failed. The resource manager may mark the transaction as rollback-only If TMSUCCESS is specified, the portion of work has completed successfully.
    Specified by:
      `end` in interface `XAResource`
    Parameters:
      `xid` - A global transaction identifier that is the same as the identifier used previously in the start method.
      `flags` - One of TMSUCCESS, TMFAIL, or TMSUSPEND.
    Throws:
      `XAException`

  - ### rollback

    public void rollback(Xid xid) throws XAException
    Specified by:
      `rollback` in interface `XAResource`
    Throws:
      `XAException`

  - ### prepare

    public int prepare(Xid xid) throws XAException
    Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
    Specified by:
      `prepare` in interface `XAResource`
    Parameters:
      `xid` - The global transaction identifier to assign to the prepared commit.
    Returns:
      A value indicating the resource manager's vote on the outcome of the transaction. The possible values are: XA_RDONLY or XA_OK. If the resource manager wants to roll back the transaction, it should do so by raising an appropriate XAException in the prepare method.
    Throws:
      `XAException` - An error has occurred. Possible exception values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

  - ### commit

    public void commit(Xid xid, boolean onePhase) throws XAException
    Specified by:
      `commit` in interface `XAResource`
    Throws:
      `XAException`

  - ### forget

    public void forget(Xid xid) throws XAException
    Specified by:
      `forget` in interface `XAResource`
    Throws:
      `XAException`

  - ### isSameRM

    public boolean isSameRM(XAResource xares) throws XAException
    This method must return true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing. We compare storeIDs to make that determination.
    Specified by:
      `isSameRM` in interface `XAResource`
    Parameters:
      `xares` - The XAResource to compare with.
    Returns:
      true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing.
    Throws:
      `XAException`

  - ### recover

    public Xid[] recover(int flag) throws XAException
    Obtains a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.
    Specified by:
      `recover` in interface `XAResource`
    Parameters:
      `flag` - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter.
    Returns:
      An array of zero or more XIDs of the transaction branches that are currently in a prepared or heuristically completed state. If an error occurs during the operation, the resource manager should throw the appropriate XAException.
    Throws:
      `XAException` - An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.

  - ### getTransactionTimeout

    public int getTransactionTimeout() throws XAException
    Specified by:
      `getTransactionTimeout` in interface `XAResource`
    Throws:
      `XAException`

  - ### setTransactionTimeout

    public boolean setTransactionTimeout(int seconds) throws XAException
    Specified by:
      `setTransactionTimeout` in interface `XAResource`
    Throws:
      `XAException`