polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: More ServiceActivation
Date Fri, 09 Jun 2017 10:10:23 GMT
How about the (to me) difference between "Service Activation" (singleton,
outside view) and "Service Mixin Lifecycle" (typically resource
initialization that each mixin manage on its own)? Did you figure out the
detailed semantics here as well?

Cheers

On Fri, Jun 9, 2017 at 4:10 PM, Stanislav Muhametsin <
stanislav.muhametsin@zest.mail.kapsi.fi> wrote:

> 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?? ;-)
>>
>>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message