-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix child SEFF IC #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem reasonable, it gets rid of unneccesary pointers to callers from within child contexts. Further it fixes the bug when interpreting case ExternalCallAction where the caller makes itself a caller in its interpretation context. (L224:SeffInterpreter).
I requested several changes that contribute to making the code cleaner (e.g., removing some commented lines entirely) and also documenting a bit better in the SIC the relation to the COW request.
.orElseThrow(() -> new IllegalStateException( | ||
"Since the call came from somewhere else, the context of the caller must be present, but it isn't.")); | ||
final SEFFInterpretationContext seffInterpretationContext = entity.getRequestFrom(); | ||
// .orElseThrow(() -> new IllegalStateException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
* | ||
* A context's {@code callOverWireRequest} must <b>never</b> have their | ||
* {@code replyTo} set. If {@code replyTo} is set, it is a return to a caller, | ||
* and a return cannot be the calling request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment does not help at this point. It seems more like a thought that the developer did not know where to document/put.
The comment talks about a private and encapsulated attribute of the object that this class uses.
Further the sentence "A context's {@code callOverWireRequest} must never have their
- {@code replyTo} set." is not true. If you say upon construction then its true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, i think it is true. But maybe the formulation is inconcise, i reformulated and moved it.
* | ||
* TODO Children carry the {@code calledFrom} of their parents, but not their | ||
* {@code callOverWireRequest}. However i think, they should only appear | ||
* together. [S3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is here a TODO?
I suggest merging the three paragraphs into one paragraph that concisely elaborates the relationship between the SEFFInterpretationContext and the callOverWireRequest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i created an issue for the TODO an moved the other comments to there respective attributes.
Issue: #76 while i was already at it, i also included you comment regarding the CallOverWireRequest
, such that we do not forget about them.
assert builder.callOverWireRequest == null | ||
|| (builder.callOverWireRequest != null && builder.calledFrom.isPresent()) | ||
: String.format("Missing caller in %s", this.getClass().getSimpleName()); | ||
// || (builder.callOverWireRequest == null && builder.calledFrom.isEmpty()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this comment
@@ -176,6 +188,7 @@ public Builder withParent(final SEFFInterpretationContext parent) { | |||
} | |||
|
|||
public Builder withCallOverWireRequest(final CallOverWireRequest callOverWireRequest) { | |||
assert callOverWireRequest == null || callOverWireRequest.getReplyTo().isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not simply builderNonNull(cowr). Why is it important to check from the perspective of the seff ic that the reply to is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because a SEFF must not be called by a reply-cowr. I.e. if i check whether replyTo is empty, i ensure, that i only use cowr that are actually calling a SEFF.
basically, it's just a check to prevent mishaps in case we change code later on.
@@ -126,7 +126,8 @@ public Set<SEFFInterpreted> caseBranchAction(final BranchAction branchAction) { | |||
final SEFFInterpretationContext childContext = this.context.createChildContext() | |||
.withBehaviorContext(holder) | |||
.withRequestProcessingContext(this.context.getRequestProcessingContext()) | |||
.withCaller(this.context.getCaller()) | |||
// .withCaller(this.context.getCaller()) // imho, children should not have | |||
// callers, only parents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Current
Caller Self-Reference
SEFFInterpretationContext
s (SEFFIC) that contain anExternalCallAction
get updated to be their own caller, such that we end up with object relations like this:PCM model, colours correpond to the SEFF ICs.
All blue SEFFICs are copies of each other, created when calling
update
. Note, that the copies reference the original as caller which sematically makes zero sense.Reset of
CallOverwireRequest
inonCallOverWireSucceeded
When returning from a call the callOverwireRequest (COWR) of the caller gets reset to
null
. This is wrong, because semantically the COWR of a SEFFIC is the request, by which the SEFFIC was called. The example given above works just fine, but in case of nested external calls (see figure below), returning from the SEFFIC that is both callee and caller (green) to its caller breaks.New
Caller Self-Reference
Copied SEFFICs do no longer reference their original as caller. As a follow up, the "unwrapping" of SEFFIC was adapted as well.
object relation is now like this:
Reset of
CallOverwireRequest
inonCallOverWireSucceeded
Removed the reset. Now even nested external calls can return to their caller.
Misc
StackContext
. However, theStackContext
is broken anyway, thus i suggest to ignore the Stack for this PR and fix it separately after merging this PR.