SessionManager Questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SessionManager Questions

Sean P. DeNigris
Administrator
What is the SessionManager equivalent to `Smalltalk addToStartupList: self
after: AnotherClass`?
To do it manually, I don't see an easy way to query the priority/category of
AnotherClass(edited)
Also, it seems that "higher" priority in SessionManager means a lower
number! This seems opposite of both logic and precedent (see Process), no?



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: SessionManager Questions

Sven Van Caekenberghe-2
Did you read the very nice class comment ?

> On 17 Jun 2018, at 20:20, Sean P. DeNigris <[hidden email]> wrote:
>
> What is the SessionManager equivalent to `Smalltalk addToStartupList: self
> after: AnotherClass`?
> To do it manually, I don't see an easy way to query the priority/category of
> AnotherClass(edited)
> Also, it seems that "higher" priority in SessionManager means a lower
> number! This seems opposite of both logic and precedent (see Process), no?
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>


Reply | Threaded
Open this post in threaded view
|

Re: SessionManager Questions

demarey
In reply to this post by Sean P. DeNigris
Hi Sean,

> Le 17 juin 2018 à 20:20, Sean P. DeNigris <[hidden email]> a écrit :
>
> What is the SessionManager equivalent to `Smalltalk addToStartupList: self
> after: AnotherClass`?
> To do it manually, I don't see an easy way to query the priority/category of
> AnotherClass(edited)

SessionManager was designed to avoid dependencies between classes / packages that have nothing in common.
The best way is to find the best category to register your class in but in some cases, it s not enough.
ex: you rely on a class registered in user category but you need that another class startup happens after.
In this case, you need to use priorities. You can check dependent class category by inspection the session category but, indeed, there is no way to query the priority/category of a registered handler. It was not needed until now.
Do you need to compute the priority dynamically? What is the use case?

> Also, it seems that "higher" priority in SessionManager means a lower
> number! This seems opposite of both logic and precedent (see Process), no?

You’re right. It simplifies sorting but indeed is counter-intuitive.
Changing that now will probably break things for people relying on the current behavior.

Cheers,
Christophe
Reply | Threaded
Open this post in threaded view
|

Re: SessionManager Questions

jgfoster

> On Jun 19, 2018, at 2:50 AM, Christophe Demarey <[hidden email]> wrote:
>
>> Le 17 juin 2018 à 20:20, Sean P. DeNigris <[hidden email]> a écrit :
>
>> Also, it seems that "higher" priority in SessionManager means a lower
>> number! This seems opposite of both logic and precedent (see Process), no?
>
> You’re right. It simplifies sorting but indeed is counter-intuitive.
> Changing that now will probably break things for people relying on the current behavior.

I guess it seems intuitive to me that 1st place is higher priority than 2nd place or that 1 comes before 2. But you could add a new API with a number that gets translated to/from an internal value. That is the beauty of encapsulation.

James Foster
Reply | Threaded
Open this post in threaded view
|

Re: SessionManager Questions

Sean P. DeNigris
Administrator
In reply to this post by demarey
demarey wrote
> Do you need to compute the priority dynamically?

No.


demarey wrote
> What is the use case?

I have a domain representing servers that takes the following two steps at
startup:
1. I use to store objects representing servers. SimplePersistence
materializes saved Server instances, replacing existing instances
2. The Server class cycles through all instances in a collection to refresh
their connection status.

If #2 happens before #1, the old instances will be refreshed and then
replaced by new unrefreshed ones.



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Cheers,
Sean