FWIW, I really had to sit down and think a lot about all concurrency etc
issues in C# version of Polygene.
There, I am using CompareExchange-based algorithms to simulate state
machine:
0 - Initial
1 - Activating
2 - Active
3 - Passivating
4 - Passive
Legal transitions are:
0 -> 1 (Initial activation)
1 -> 2 (Activation successful)
1 -> 4 (Exception in activation)
2 -> 3 (Starting to passivate)
3 -> 4 (Passivation successful (even if exception))
4 -> 1 (Re-activating)
That way, I can also detect recursive calls within
activation/passivation methods (when state is 1 or 3), which helps avoid
some nasty StackOveflowExceptions and other inconsistencies.
I've got things to work very nicely even in very large and complex
applications, where service activations can cascade multiple layers down.
On 09/06/2017 05:50, Niclas Hedhman wrote:
> I found another bad side-effect of the current Service Activation.
>
> The issue I have is that a Private Mixin is not seen by the Service
> Activation system, and activateService() is never called.
>
> So, I thought that I simply do a delegation from the public Mixin to the
> private one;
>
> @This
> private MyPrivate parts;
>
>
> public void activateService()
> throw Exception
> {
> parts.activateService();
> }
>
>
> Anybody cares to guess what Exception I got?? ;-)
>
|