Enum ClientTransactionPolicy
- All Implemented Interfaces:
Serializable,Comparable<ClientTransactionPolicy>,java.lang.constant.Constable
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFail with exception when there is no client-side transaction context; propagate the client-side transaction context when it is present.Invoke without propagating any transaction context; if a client-side transaction context is present, an exception is thrown.Invoke without propagating any transaction context whether or not a client-side transaction context is present.Invoke without a transaction if there is no client-side transaction context; propagate the client-side transaction context if it is present. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether this transaction policy causes a failure when a client-side transaction context is absent.booleanDetermine whether this transaction policy causes a failure when a client-side transaction context is present.booleanDetermine whether this instance is equal to one of the given instances.booleanin(ClientTransactionPolicy... values) Determine whether this instance is equal to one of the given instances.booleanDetermine whether this instance is equal to one of the given instances.booleanDetermine whether this instance is equal to one of the given instances.static booleanDetermine whether the given set is fully populated (or "full"), meaning it contains all possible values.booleanDetermine whether this transaction policy causes the client-side transaction context (if any) to be propagated to invocations.static ClientTransactionPolicyReturns the enum constant of this type with the specified name.static ClientTransactionPolicy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
MANDATORY
Fail with exception when there is no client-side transaction context; propagate the client-side transaction context when it is present. The target is never invoked without a client-side transaction context.This mode is compatible with the following server-side transaction attribute types:
TransactionAttributeType.MANDATORYTransactionAttributeType.REQUIREDTransactionAttributeType.SUPPORTS
TransactionAttributeType.MANDATORY.This mode may be used with
TransactionAttributeType.REQUIRES_NEWandTransactionAttributeType.NOT_SUPPORTED, but such usage may not make sense in most situations because the transaction that is required to be propagated by the client will always be suspended on the server; in this case, a client-side policy ofTransactionAttributeType.NOT_SUPPORTEDis recommended to avoid the useless propagation of the client-side transaction context.Usage of this mode with the following server-side transaction attribute types will always result in an exception, and is therefore not recommended:
TransactionAttributeType.NEVER
-
SUPPORTS
Invoke without a transaction if there is no client-side transaction context; propagate the client-side transaction context if it is present. The target may be invoked with or without a client-side transaction context.This is the overall default policy.
This mode is compatible with the following server-side transaction attribute types:
TransactionAttributeType.REQUIREDTransactionAttributeType.SUPPORTSTransactionAttributeType.NOT_SUPPORTED
TransactionAttributeType.NEVERandTransactionAttributeType.MANDATORY, however the success of the invocation of such methods will depend on the local transaction state.Unlike
TransactionAttributeType.SUPPORTS, this client-side transaction policy is generally safe to use in all cases, as it still allows the server to decide to create a new transaction according to local policy.This mode may be used with
TransactionAttributeType.REQUIRES_NEW, but such usage may not make sense in most situations because the transaction that is propagated by the client (if any) will always be suspended on the server; in this case, a client-side policy ofNOT_SUPPORTEDis recommended to avoid the useless propagation of the client-side transaction context. -
NOT_SUPPORTED
Invoke without propagating any transaction context whether or not a client-side transaction context is present. The target is always invoked without a client-side transaction context.This mode is compatible with the following server-side transaction attribute types:
TransactionAttributeType.REQUIREDTransactionAttributeType.REQUIRES_NEWTransactionAttributeType.SUPPORTSTransactionAttributeType.NOT_SUPPORTED
TransactionAttributeType.NEVER, however, in this case the server will never see the client-side transaction, causing the invocation to effectively use the server-side modeTransactionAttributeType.NOT_SUPPORTEDin this case, which might result in unexpected behavior.Usage of this mode with the following server-side transaction attribute types will always result in an exception, and is therefore not recommended:
TransactionAttributeType.MANDATORY
-
NEVER
Invoke without propagating any transaction context; if a client-side transaction context is present, an exception is thrown.This mode is compatible with the following server-side transaction attribute types:
TransactionAttributeType.REQUIREDTransactionAttributeType.REQUIRES_NEWTransactionAttributeType.SUPPORTSTransactionAttributeType.NOT_SUPPORTED
TransactionAttributeType.NEVER, however, in this case the server will never see the client-side transaction, causing the invocation to effectively use the server-side modeTransactionAttributeType.NOT_SUPPORTEDin this case, which might result in unexpected behavior.Usage of this mode with the following server-side transaction attribute types will always result in an exception, and is therefore not recommended:
TransactionAttributeType.MANDATORY
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
failIfTransactionPresent
public boolean failIfTransactionPresent()Determine whether this transaction policy causes a failure when a client-side transaction context is present.- Returns:
trueif the policy would fail when a transaction is present,falseotherwise
-
failIfTransactionAbsent
public boolean failIfTransactionAbsent()Determine whether this transaction policy causes a failure when a client-side transaction context is absent.- Returns:
trueif the policy would fail when a transaction is absent,falseotherwise
-
propagate
public boolean propagate()Determine whether this transaction policy causes the client-side transaction context (if any) to be propagated to invocations.- Returns:
trueif the transaction is propagated by this policy,falseotherwise
-
isFull
Determine whether the given set is fully populated (or "full"), meaning it contains all possible values.- Parameters:
set- the set- Returns:
trueif the set is full,falseotherwise
-
in
Determine whether this instance is equal to one of the given instances.- Parameters:
v1- the first instance- Returns:
trueif one of the instances matches this one,falseotherwise
-
in
Determine whether this instance is equal to one of the given instances.- Parameters:
v1- the first instancev2- the second instance- Returns:
trueif one of the instances matches this one,falseotherwise
-
in
public boolean in(ClientTransactionPolicy v1, ClientTransactionPolicy v2, ClientTransactionPolicy v3) Determine whether this instance is equal to one of the given instances.- Parameters:
v1- the first instancev2- the second instancev3- the third instance- Returns:
trueif one of the instances matches this one,falseotherwise
-
in
Determine whether this instance is equal to one of the given instances.- Parameters:
values- the possible values- Returns:
trueif one of the instances matches this one,falseotherwise
-