@Internal public interface XaFacade extends JdbcConnectionProvider, Serializable, AutoCloseable
sink
.
Typical workflow:
open()
start(javax.transaction.xa.Xid)
transaction
JdbcConnectionProvider.getConnection()
, write some data
endAndPrepare(javax.transaction.xa.Xid)
(or failAndRollback(javax.transaction.xa.Xid)
)
commit(javax.transaction.xa.Xid, boolean)
/ rollback(javax.transaction.xa.Xid)
AutoCloseable.close()
recover()
can be used to get abandoned prepared transactions for cleanup.Modifier and Type | Interface and Description |
---|---|
static class |
XaFacade.EmptyXaTransactionException
|
static class |
XaFacade.TransientXaException
Indicates a transient or unknown failure from the resource manager (see
XA_RBTRANSIENT , XAER_RMFAIL ). |
Modifier and Type | Method and Description |
---|---|
void |
commit(Xid xid,
boolean ignoreUnknown)
Commit previously prepared transaction.
|
void |
endAndPrepare(Xid xid)
End and then prepare the transaction.
|
void |
failAndRollback(Xid xid)
End transaction as
failed ; in case of error,
try to roll it back. |
static XaFacade |
fromXaDataSourceSupplier(java.util.function.Supplier<XADataSource> dataSourceSupplier,
Integer timeoutSec,
boolean transactionPerConnection) |
boolean |
isOpen() |
void |
open() |
Collection<Xid> |
recover()
Note: this can block on some non-MVCC databases if there are ended not prepared transactions.
|
void |
rollback(Xid xid)
Rollback previously prepared transaction.
|
void |
start(Xid xid)
Start a new transaction.
|
closeConnection, getConnection, getOrEstablishConnection, isConnectionValid, reestablishConnection
close
static XaFacade fromXaDataSourceSupplier(java.util.function.Supplier<XADataSource> dataSourceSupplier, Integer timeoutSec, boolean transactionPerConnection)
boolean isOpen()
void endAndPrepare(Xid xid) throws Exception
Exception
void commit(Xid xid, boolean ignoreUnknown) throws XaFacade.TransientXaException
ignoreUnknown
- whether to ignore XAER_NOTA
error.XaFacade.TransientXaException
void rollback(Xid xid) throws XaFacade.TransientXaException
XaFacade.TransientXaException
void failAndRollback(Xid xid) throws XaFacade.TransientXaException
failed
; in case of error,
try to roll it back.XaFacade.TransientXaException
Collection<Xid> recover() throws XaFacade.TransientXaException
XaFacade.TransientXaException
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.