Replies: 9 comments 10 replies
-
@niACS said he would reach out to SLM about reasons why this was decided against during the inception of AF. |
Beta Was this translation helpful? Give feedback.
-
From Stephen Loftus-Mercer: Launch [Root|Nested] Actor are very deliberately NOT dynamic dispatch. If you make Launch [R|N] Actor dynamic dispatch and you do NOT set "must call parent", then things are completely trashed... you no longer have a thread-safe bottleneck at all for actor launches; guarantees for Drop Message are gone; Last Ack is not guaranteed. In short, that's really bad, so let's not do that. So I assume you want to make it dynamic dispatch AND set "must call parent". I think I need specific examples of what you're trying to do, because I think all the use cases are already covered. If you want to verify something is true of the actor object as part of launch, that's what Pre-Launch Init is for -- an error there prevents the launch, so you just need to override and check the settings of the object. Pre-Launch Init runs at a point where you can reserve resources from the rest of the system safely, without worrying that there are other actors launching at the same time. If we make Launch Root Actor be dynamic dispatch, you'd be doing checks that could be happening simultaneously with other launches (because even though it isn't reentrant, each of the overrides could be running parallel with each other). That means only some of the things that you might want to check as part of launch could be checked there -- that splits into two locations the "pre launch checks" code, and only some of them belong in one part, with the others being a subtle bug in edge cases. I do not know of any use case for making those launchers dynamic dispatch. I'm happy to hear about one if you think you've found one. |
Beta Was this translation helpful? Give feedback.
-
The only use case I've encountered is Panel Actors, which have their own versions of Launch Actor. I note, however, that those launchers have additional inputs, so they aren't candidates for being dynamic dispatch overrides. If we look at the use cases, we may find that this is more of a training issue, regarding actor life cycle and the proper use of Pre Launch Init.vi. |
Beta Was this translation helpful? Give feedback.
-
Here's a use case that we've often encountered (and experience ourselves): Say a particular application has a logger process that you want all actors to have messaging access to. For this application logging is viewed as a top priority and you don't want to risk it getting caught in an AF message bottleneck under any circumstances, hence the direct access. Access can be via an enqueuer or DVR or whatever, but for this example, let's say that whatever it is, it's wrapped in a "Logger API" class. It doesn't really matter the mechanism, but what's important is that the same Logger API class needs to be in every actor. Now, if it's in every actor, we make the Logger API class a part of the private data in a base actor the for the entire application. To ensure that the class is given to every actor in the application, you'd probably want to access that class in the calling actor's private data and populate it in the nested actor's private data before launch. If "Launch Nested Actor" were dynamic dispatch you could override that method in your application's base actor and make sure the Logger API class was always passed to a nested actor. You couldn't do this in Pre Launch Init because once you're there, you don't have access to the calling actor's private data anymore. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I use the custom launch actor strategy that Casey describes. We have a DD method (though I believe only the base actor actually implements it) that we can add in the custom behavior we need for launching actors. We do not have a custom connector pane, so it would work for us to use the DD AF version if it was available. I do however see the problem ACS brings up where custom inputs may be needed, which would make a custom solution the only way to do it (or accessors, but that leads to a lot of code duplication and more issues in my experience). I think for my team and our use case, it would help to just override the framework method instead of having to use our own. We have had issues with using the wrong launcher before, as the AF version still works of course, but our custom data isn't transferred, so we get errors that are more difficult to find for us (the logger is part of passed data, so the logs are useless to find this error). But on the other hand, I don't know if this will work for all use cases, as Panel Actor demonstrates. I would think that the safeguard could still be implemented by making the method require calling the parent, would it not? |
Beta Was this translation helpful? Give feedback.
-
It seems like the only use case for a dynamic dispatch Launch Actor is to hand off data from the caller to the nested. The data in this case is fixed system-level data, and the actors all have some common parent. It seems like we can solve this with a new DD method on the parent class ("Transfer Parent Attributes") or some such, that gets called within Launch Nested. (I don't see a use case for a DD override of Launch Root - what are you transferring?) Now, a question: on which actor do we dispatch? Further, that question makes me realize that this option will only work on actors with common parents. That can be very useful (see Substitute Actor), but it's corner case. |
Beta Was this translation helpful? Give feedback.
-
OK, current proposal to answer this request is to add a new dynamic dispatch VI, Transfer Attributes to Nested Actor. This method would be protected, and would require calling the parent node. It will dispatch on the calling actor. The new VI will be called in Launch Nested Actor (only), and just prior to the call to Launch Actor Core. It will take the Caller and Nested actor objects as inputs, and will return the Nested actor object and an error cluster. We are considering returning the Caller as well, which would allow for some update to caller data, but we are concerned that users might do something deranged like swap the Caller and Nested actors, so I'm leaning toward not. Please share your thoughts on this proposal. |
Beta Was this translation helpful? Give feedback.
-
I said I'd put in notes from the meeting, here they finally are: The consensus after quite a circular discussion is to not change anything about The template pattern DD approach I suggested lead to a lot of counter-examples and questions:
The only approach that enables having strictly typed connector panes that are aware of more specific relationships is to continue with the practice of custom static launchers. Any of the DD approaches lead to generalization issues making some errors that could be caught at edit time move to run-time errors which are overall more effort to deal with. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
In our own, as well as other inherited projects, one of most common things developers want to do is to populate a nested actor with a common set of data before it's launched (think something like a reference to a logger). The most common solution to this I see is a wrapper around the native "Launch Nested Actor", but why not just make it dynamic dispatch so it could actors could inherit common behavior from an ancestor base actor.
Describe the solution you'd like
Make the inputs for "Launch Nested Actor" dynamic dispatch. Maybe requiring the overrides to call the parent class method is also necessary.
Describe alternatives you've considered
Sticking with the wrappers.
Additional context
N/A
Beta Was this translation helpful? Give feedback.
All reactions