@Retention(value=RUNTIME) @Target(value=METHOD) public @interface TransactionPolicy
ProgramLifecycle
method to indicate that it will not run inside transaction.
By default, program life cycle methods (initialize
, destroy
), are run inside a transaction. Some
methods do not require a transaction, or they need to control their transactions themselves. Such
a method can be annotated, for example in a worker, with:
@Override
@TransactionPolicy(TransactionControl.EXPLICIT)
public void initialize(WorkerContext context) {
...
}
This is especially useful if the method may run longer than the transaction timeout, and it would
then fail if run inside a transaction.Modifier and Type | Required Element and Description |
---|---|
TransactionControl |
value |
public abstract TransactionControl value
Copyright © 2024 Cask Data, Inc. Licensed under the Apache License, Version 2.0.