JIRA-73 TrxConstraints

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Overview

See https://adempiere.atlassian.net/browse/ADEMPIERE-73

Functionality definition
Name: TrxConstraints
Entity Type:
Table Prefix: 
Reference Data: No
Module Language: English
Translation Required: No
Dependencies:


Transaction constraints can be defined on a per-thread basis and are enforced by the system. A user can obtain her constraints instance by calling org.compiere.util.DB.getConstraints() and can then customize that instance for the particular thread's needs.

Motivation
Within ADempiere, we should have a way to enforce trx-Constraints to guard against misbehaving code which might otherwise affect the overall runtime stability of the system.
Examples
  • When implementing a new process, we want to make sure that there is no unexpected stuff taking place outside of the "main" transaction (e.g. in custom model validators).
  • When working on complex issues (e.g. GUIs with a lot of callouts), we want to make sure that no open transactions are left behind to block further database access
Therefore we need to specify (e.g.) that there may only be a limited number of transactions opened from the current thread at the same time. Or a limited number of save points per transaction. Or, that all transactions opened by a given thread have to be finished (committed or rolled back) within a given timeout.
Important
Note that the feature is disabled, unless org.compiere.util.trxConstraints.disabled = 'N' is added to the AD_SysConfig. The idea is to enforce TrxConstraints during development and testing only, because many weird usages of Trx do actually work and we don't wont the TrxConstaints to prevent a production system from working.

References

Development

Developers

Testers

Sponsors