public static Single < XianTransaction > getTransaction ( String transactionId , boolean readOnly ) { if ( BaseLocalTransaction . getExistedLocalTrans ( transactionId ) != null ) { return Single . just ( BaseLocalTransaction . getExistedLocalTrans ( transactionId ) ) ; } if ( readOnly ) { return PoolFactory . getPool ( ) . getSlaveDatasource ( ) . getConnection ( ) . map ( connection -> connection . createTransaction ( transactionId ) ) ; } else { return PoolFactory . getPool ( ) . getMasterDatasource ( ) . getConnection ( ) . map ( connection -> connection . createTransaction ( transactionId ) ) ; } }
create or get the current xian transaction . This method is always returning a transaction reference for you .