GP-1072: Should grab the readlock before others if any reading is to be done.

This commit is contained in:
Dan 2021-06-25 10:14:54 -04:00
parent 7f50d8f430
commit 42395cbd37

View file

@ -525,6 +525,8 @@ public class DBTrace extends DBCachedDomainObjectAdapter implements Trace, Trace
@Override
public DBTraceProgramView getFixedProgramView(long snap) {
// NOTE: The new viewport will need to read from the time manager during init
try (LockHold hold = lockRead()) {
synchronized (fixedProgramViews) {
DBTraceProgramView view = fixedProgramViews.computeIfAbsent(snap, t -> {
Msg.debug(this, "Creating fixed view at snap=" + snap);
@ -533,9 +535,12 @@ public class DBTrace extends DBCachedDomainObjectAdapter implements Trace, Trace
return view;
}
}
}
@Override
public DBTraceVariableSnapProgramView createProgramView(long snap) {
// NOTE: The new viewport will need to read from the time manager during init
try (LockHold hold = lockRead()) {
synchronized (programViews) {
DBTraceVariableSnapProgramView view =
new DBTraceVariableSnapProgramView(this, snap, baseCompilerSpec);
@ -543,6 +548,7 @@ public class DBTrace extends DBCachedDomainObjectAdapter implements Trace, Trace
return view;
}
}
}
@Override
public DBTraceVariableSnapProgramView getProgramView() {