Include the post commit/abort function execution time that happens within/associated-with the scope of a UOW. Fix reset method to check both maps for updates.
This commit is contained in:
parent
26f41dab75
commit
27dd9a4eff
2 changed files with 21 additions and 6 deletions
|
@ -151,10 +151,19 @@ public abstract class AbstractEntityDraft<E> implements Drafted<E> {
|
||||||
return this.<T>reset(this.<T>methodNameFor(getter), desiredValue);
|
return this.<T>reset(this.<T>methodNameFor(getter), desiredValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> T fetch(String key) {
|
||||||
|
T value = (T) backingMap.get(key);
|
||||||
|
|
||||||
|
if (value == null) {
|
||||||
|
value = (T) entityMap.get(key);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
public <T> boolean reset(String key, T desiredValue) {
|
public <T> boolean reset(String key, T desiredValue) {
|
||||||
if (key != null && desiredValue != null) {
|
if (key != null && desiredValue != null) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T currentValue = (T) backingMap.get(key);
|
T currentValue = (T) this.<T>fetch(key);
|
||||||
if (currentValue == null || !currentValue.equals(desiredValue)) {
|
if (currentValue == null || !currentValue.equals(desiredValue)) {
|
||||||
set(key, desiredValue);
|
set(key, desiredValue);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -200,9 +200,6 @@ public abstract class AbstractUnitOfWork<E extends Exception>
|
||||||
f.apply();
|
f.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LOG.isInfoEnabled()) {
|
|
||||||
LOG.info(logTimers(what));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -365,7 +362,6 @@ public abstract class AbstractUnitOfWork<E extends Exception>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canCommit) {
|
if (!canCommit) {
|
||||||
elapsedTime.stop();
|
|
||||||
|
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
|
|
||||||
|
@ -376,11 +372,16 @@ public abstract class AbstractUnitOfWork<E extends Exception>
|
||||||
uow -> {
|
uow -> {
|
||||||
applyPostCommitFunctions("aborted", abortThunks);
|
applyPostCommitFunctions("aborted", abortThunks);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
elapsedTime.stop();
|
||||||
|
if (LOG.isInfoEnabled()) {
|
||||||
|
LOG.info(logTimers("aborted"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PostCommitFunction(this, null, null, false);
|
return new PostCommitFunction(this, null, null, false);
|
||||||
} else {
|
} else {
|
||||||
elapsedTime.stop();
|
|
||||||
committed = true;
|
committed = true;
|
||||||
aborted = false;
|
aborted = false;
|
||||||
|
|
||||||
|
@ -404,6 +405,11 @@ public abstract class AbstractUnitOfWork<E extends Exception>
|
||||||
new HelenusException(
|
new HelenusException(
|
||||||
"Futures must be resolved before their unit of work has committed/aborted.")));
|
"Futures must be resolved before their unit of work has committed/aborted.")));
|
||||||
|
|
||||||
|
elapsedTime.stop();
|
||||||
|
if (LOG.isInfoEnabled()) {
|
||||||
|
LOG.info(logTimers("committed"));
|
||||||
|
}
|
||||||
|
|
||||||
return new PostCommitFunction(this, null, null, true);
|
return new PostCommitFunction(this, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue