Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt on session listeners

 
Venkat Yerramsetty
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers,

As per the specification-
On application shutdown, listeners are notified in reverse order to their declarations
with notifications to session listeners preceeding notifications to context listeners.
Session listeners must be notified of session invalidations prior to context listeners
being notified of application shutdown.


Does that mean, session listeners no matter the order in the DD with mixup of context listeners will be called prior to the context listeners, and if we have a couple of session listeners then their order would have to be taken care by the developer?

I am a bit confused


 
Abhijit Rai
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
IMHO first the session listeners are notified and then the context listeners.
Lets elaborate ,suppose we have two session listeners and two context listeners .
The SessionListener1 precedes SessionListener2 in dd ,similarly ContextListener1 precedes ContetListener2.
Now when shutdown occurs then the notification order is :
SessionListener2
SessionListener1
ContextListener2
ContextListener1

Cheers!
 
Sourin K. Sen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat Yerramsetty wrote:
Does that mean, session listeners no matter the order in the DD with mixup of context listeners will be called prior to the context listeners, and if we have a couple of session listeners then their order would have to be taken care by the developer?


Its not like the order of the session listeners doesn't matters. Just as Abhijit pointed out, the sessions listeners will be called in the reverse order of declaration of their own kind, but if a context listener precedes sessions listeners in the DD, only then the session listeners takes the precedence and it is perfectly suited.

Think about it, if a context is destroyed before the session listeners are called, what good it will be? That's why session listeners have precedence over context listeners but amongst themselves, they follow the order in which they were declared.
 
Venkat Yerramsetty
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Abhi and Sourin that clears my doubt.

But what is you have One which implements both Session and Context listener-->listener1, one that implements only Context listener-->listener2 and you want to call listener2 prior to listener1.javascript:emoticon('');


Thanks
Venkat

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic