Package fr.becpg.repo.audit.service
Class DatabaseAuditScope
java.lang.Object
fr.becpg.repo.audit.service.DatabaseAuditScope
- All Implemented Interfaces:
AutoCloseable
DatabaseAuditScope class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DatabaseAuditPluginprivate Map<String, Serializable> private booleanprivate DatabaseAuditServiceprivate booleanprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionDatabaseAuditScope(DatabaseAuditPlugin auditPlugin, DatabaseAuditService databaseAuditService) Constructor for DatabaseAuditScope. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private voidvoidHand the completion of the entry over to the thread that actually runs the operation.voiddisableAuditRecord.voidputAttribute(String string, Object attribute) putAttribute.voidRecord the entry of an operation that may never complete, before running it.voidstart()start.
-
Field Details
-
databaseAuditService
-
auditPlugin
-
auditValues
-
shouldRecordAudit
private boolean shouldRecordAudit -
startRecorded
private boolean startRecorded -
completedElsewhere
private boolean completedElsewhere
-
-
Constructor Details
-
DatabaseAuditScope
public DatabaseAuditScope(DatabaseAuditPlugin auditPlugin, DatabaseAuditService databaseAuditService) Constructor for DatabaseAuditScope.
- Parameters:
auditPlugin- aDatabaseAuditPluginobjectdatabaseAuditService- aDatabaseAuditServiceobject
-
-
Method Details
-
disableAuditRecord
public void disableAuditRecord()disableAuditRecord.
-
recordStart
public void recordStart()Record the entry of an operation that may never complete, before running it. The entry is flagged as not completed and is replaced by the completed one when the scope is closed. Only the plugins declaringDatabaseAuditPlugin.isRecordOnStart()take part in this two phase recording. -
deferCompletion
public void deferCompletion()Hand the completion of the entry over to the thread that actually runs the operation. Closing the scope then only records the entry of the started operation: the duration of an asynchronous export measured by the thread that requested it would be the duration of the request, not the one of the export. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
putAttribute
putAttribute.
-
start
public void start()start.
The identifier a completed entry replaces its started one on is drawn at random: derived from the start date alone, two operations starting in the same millisecond would share it and completing one would delete the entry of the other. -
completeAuditValues
private void completeAuditValues()
-