-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record operation result times for QObjectMapping
Signed-off-by: Tony Tkáčik <tonydamage@gmail.com>
- Loading branch information
1 parent
f7399ea
commit 3cfc72d
Showing
3 changed files
with
120 additions
and
57 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/SqaleOperationResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.evolveum.midpoint.repo.sqale; | ||
|
||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
|
||
public class SqaleOperationResult implements AutoCloseable { | ||
private static ThreadLocal<OperationResult> CURRENT_OPERATION_RESULT = new ThreadLocal<>(); | ||
|
||
public static OperationResult get() { | ||
var maybe = CURRENT_OPERATION_RESULT.get(); | ||
if (maybe != null) { | ||
return maybe; | ||
} | ||
// Nullables (for operations we are not tracking) | ||
return new OperationResult("temporary"); | ||
} | ||
|
||
public static OperationResult set(OperationResult result) { | ||
CURRENT_OPERATION_RESULT.set(result); | ||
return result; | ||
} | ||
|
||
public static void free() { | ||
CURRENT_OPERATION_RESULT.remove(); | ||
} | ||
|
||
public static OperationResult createSubresult(String name) { | ||
return get().createSubresult(name); | ||
} | ||
|
||
public static SqaleOperationResult with(OperationResult result) { | ||
set(result); | ||
return new SqaleOperationResult(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
free(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters