@Component(value="blStreamingTransactionCapableUtil") @Scope(value="prototype") public class StreamingTransactionCapableUtil extends Object implements StreamingTransactionCapable
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected int |
pageSize |
protected org.springframework.transaction.PlatformTransactionManager |
platformTransactionManager |
protected int |
retryMax |
Constructor and Description |
---|
StreamingTransactionCapableUtil() |
Modifier and Type | Method and Description |
---|---|
protected <G extends Throwable> |
endTransaction(org.springframework.transaction.TransactionStatus status,
boolean error,
Class<G> exceptionType,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
int |
getPageSize()
The result set size per page of data when streaming.
|
int |
getRetryMax() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
void |
init() |
void |
runOptionalEntityManagerInViewOperation(Runnable runnable)
Executes the Runnable operation in the scope of an Entity-Manager-In-View pattern, if there is not already an
EntityManager on the thread.
|
<G extends Throwable> |
runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType,
boolean useTransaction)
Run an operation inside of a single transaction.
|
<G extends Throwable> |
runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType,
boolean useTransaction,
int transactionBehavior,
int isolationLevel) |
<G extends Throwable> |
runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType,
boolean useTransaction,
int transactionBehavior,
int isolationLevel,
boolean readOnly,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
<G extends Throwable> |
runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation,
Class<G> exceptionType)
Run a streaming operation inside a transaction.
|
<G extends Throwable> |
runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation,
Class<G> exceptionType,
int transactionBehavior,
int isolationLevel) |
<G extends Throwable> |
runTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType)
Run an operation inside of a single transaction.
|
<G extends Throwable> |
runTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType,
int transactionBehavior,
int isolationLevel) |
<G extends Throwable> |
runTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
void |
setPageSize(int pageSize) |
void |
setRetryMax(int retryMax) |
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) |
protected org.springframework.transaction.TransactionStatus |
startTransaction(int propagationBehavior,
int isolationLevel,
boolean isReadOnly,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
protected org.springframework.transaction.PlatformTransactionManager platformTransactionManager
protected javax.persistence.EntityManager em
@Value(value="${streaming.transaction.lock.retry.max}") protected int retryMax
@Value(value="${streaming.transaction.item.page.size}") protected int pageSize
@PostConstruct public void init()
public <G extends Throwable> void runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType) throws G extends Throwable
StreamingTransactionCapable
StreamCapableTransactionalOperation
API to determine
the page of data to work on within the transaction scope.runStreamingTransactionalOperation
in interface StreamingTransactionCapable
G
G extends Throwable
public <G extends Throwable> void runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType, int transactionBehavior, int isolationLevel) throws G extends Throwable
runStreamingTransactionalOperation
in interface StreamingTransactionCapable
G extends Throwable
public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType) throws G extends Throwable
StreamingTransactionCapable
TransactionalOperation.execute()
.runTransactionalOperation
in interface StreamingTransactionCapable
G
G extends Throwable
public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, org.springframework.transaction.PlatformTransactionManager transactionManager) throws G extends Throwable
runTransactionalOperation
in interface StreamingTransactionCapable
G extends Throwable
public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, int transactionBehavior, int isolationLevel) throws G extends Throwable
runTransactionalOperation
in interface StreamingTransactionCapable
G extends Throwable
public <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction) throws G extends Throwable
StreamingTransactionCapable
TransactionalOperation.execute()
. The useTransaction parameter
allows the inclusion of some logic to determine whether or not the creation of the transaction is required for the operation. This is
useful in situations where there may already be an active transaction that you want to use, if available.runOptionalTransactionalOperation
in interface StreamingTransactionCapable
G
G extends Throwable
public <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction, int transactionBehavior, int isolationLevel) throws G extends Throwable
runOptionalTransactionalOperation
in interface StreamingTransactionCapable
G extends Throwable
public void runOptionalEntityManagerInViewOperation(Runnable runnable)
StreamingTransactionCapable
runOptionalEntityManagerInViewOperation
in interface StreamingTransactionCapable
public <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction, int transactionBehavior, int isolationLevel, boolean readOnly, org.springframework.transaction.PlatformTransactionManager transactionManager) throws G extends Throwable
runOptionalTransactionalOperation
in interface StreamingTransactionCapable
G extends Throwable
public int getPageSize()
StreamingTransactionCapable
StreamingTransactionCapable.runStreamingTransactionalOperation(StreamCapableTransactionalOperation, Class)
.getPageSize
in interface StreamingTransactionCapable
public void setPageSize(int pageSize)
setPageSize
in interface StreamingTransactionCapable
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
getTransactionManager
in interface StreamingTransactionCapable
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
setTransactionManager
in interface StreamingTransactionCapable
public int getRetryMax()
getRetryMax
in interface StreamingTransactionCapable
public void setRetryMax(int retryMax)
setRetryMax
in interface StreamingTransactionCapable
protected <G extends Throwable> void endTransaction(org.springframework.transaction.TransactionStatus status, boolean error, Class<G> exceptionType, org.springframework.transaction.PlatformTransactionManager transactionManager) throws G extends Throwable
G extends Throwable
protected org.springframework.transaction.TransactionStatus startTransaction(int propagationBehavior, int isolationLevel, boolean isReadOnly, org.springframework.transaction.PlatformTransactionManager transactionManager)
Copyright © 2022. All rights reserved.