|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
TransactionEventListener | Listener interface for TransactionService -related events. |
TransactionService | General interface for a Transaction managing service. |
Class Summary | |
---|---|
AbstractTransactionService | Base class for every actual implementation of TransactionService . |
AbstractTransactionService.Context | |
AbstractTransactionService.TransactionObject | |
RollbackExceptionContribution | Represents a configuration parameter to the Transaction Interceptor configured for a service. |
TransactionContribution | Represents a configuration parameter to the Transaction Interceptor configured for a service. |
TransactionInterceptorFactory | This service creates service interceptors that manage transactions. |
TransactionSettingsContribution |
Enum Summary | |
---|---|
TransactionDemarcation | Defines the transaction demarcation for an executable scope (method of a service). |
Exception Summary | |
---|---|
ForbiddenTransactionException | Thrown by TransactionService implementations when a transaction
currently exists but the current context does not allow any. |
MandatoryTransactionException | Thrown by TransactionService implementations when a transaction
is currently required but does not exist in the current context. |
TransactionException | Thrown by TransactionService implementations when transaction
management fails. |
This is the main package for generic transaction handling under HiveMind.
It defines the necessary interfaces and classes for dealing generally with transactions under HiveMind.TransactionService
.
The implementations of this service handle the real transactions in a thread-safe manner.
TransactionInterceptor
to the service that needs transaction management.
It is possible to configure the Transaction demarcation for any method of the service that is intercepted. Hence, some methods may have no Transaction context during their execution, while others may force the existence of one transaction.
this
, then the interceptors are never called and hence specific demarcation to the called method does not apply.
TransactionService
and then call its methods directly. It is important to make sure that a transaction scope that is open programmatically by a service will always be ended by this service (at least before the end of execution of the current thread, but it is strongly advises that the method that begins a transaction scope ends it before returning, even in case of an exception).
TransactionService
.
If needed, the easiest way to implement a new one is to derive from AbstractTransactionService
and implement the few abstract methods; this way, you do not have to deal with the management of transaction scope switching and demarcation handling... You just have to write the code that creates a new transaction and that later commits or rollback that transaction.
TransactionInterceptor
. The configuration for the interceptor includes the transaction demarcation to be used for the service (or for individual methods of the service), and the way to deal with transaction commit or rollback when exceptions are thrown by the service.<interceptor service-id="hivetranse.core.TransactionInterceptor"> <method pattern="*" demarcation="Required"/> <exception name="java.lang.Throwable" rollback="true"/> </interceptor>In the example above, the configuration means that a call to any method of the service will use the
Required
transaction demarcation, and that any exception thrown will rollback the current transaction (here, this is different from EJB behavior where only unchecked exceptions would rollback the current transaction).<interceptor>
declaration.<contribution configuration-id="hivetranse.core.TransactionDefaults"> <defaults> <exception name="java.lang.Exception" rollback="false"/> <exception name="java.lang.Throwable" rollback="true"/> <method pattern="*" demarcation="Never"/> </defaults> </contribution>This default configuration mimics the way an EJB container works, except for the fact that EJB has no "default" transaction demarcation and obliges you to define it for your beans.
<interceptor service-id="hivetranse.core.TransactionInterceptor"/>Please not that if you do not define a Transaction Interceptor for a service, then the kind of transaction demarcation for this service will be the same as was existing in for the caller of that service.
NotSupported
demarcation, ie no transaction is available to your service.
hivetranse.core
and EJB must be noted:
Never
), any call to a database-related service (eg JDBC Connection or Hibernate Session) will fail. In EJB, this point is left to the Container implementation...
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |