You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Barry Kaplan <gr...@memelet.com> on 2005/07/20 21:32:48 UTC

ProtocolSession attributes race condition

I am using the attributes on ProtocolSession to add in domain specific 
session extensions (ie, Quickfix Sesison's). Of course I can only set 
these attributes after the ProtocolSession is created. But within the 
call to ProtocolConnector.connect, ProtocolHandler.sessionOpened gets 
invoked. The implementation for quickfix requires the attributes that 
have not yet been set. It seems that the invocation of 
ProtocolHandler.sessionOpened is async, since the attributes are missing 
only intermittently.

Is there another way to poke the attributes into the session before any 
callbacks are invoked?

In a previous impl (that I just got done ripping out last night) I would 
create a new instance of QuickfixProtoclHandler for each mina session. 
But I thought it would be cleaner to use the attibutes. Do I need to go 
back to the previous impl?

-- 
barry kaplan
groups1@memelet.com

Re: ProtocolSession attributes race condition

Posted by Barry Kaplan <gr...@memelet.com>.
Trustin Lee wrote:

>
> What do you think about using sessionCreated event handler?
>

That requires that the ProtocolHandler know the attribute for that 
particular ProtocolSession. Which means I need unique instance of 
ProtocolHandler per ProtocolSession. This also implies that I need a 
unique ProtocolProvider per ProtocolSession, because I need to get the 
value to the ProtocolProvider instance.

And that it what I have done. I have gone back to creating a new 
provider/handler for each session. This is really not a problem, except 
that creating a new provider seems a bit odd.

thanks!

-barry

Re: ProtocolSession attributes race condition

Posted by Trustin Lee <tr...@gmail.com>.
Hi Barry,

What do you think about using sessionCreated event handler?

Trustin

2005/7/21, Barry Kaplan <gr...@memelet.com>:
> 
> I am using the attributes on ProtocolSession to add in domain specific
> session extensions (ie, Quickfix Sesison's). Of course I can only set
> these attributes after the ProtocolSession is created. But within the
> call to ProtocolConnector.connect, ProtocolHandler.sessionOpened gets
> invoked. The implementation for quickfix requires the attributes that
> have not yet been set. It seems that the invocation of
> ProtocolHandler.sessionOpened is async, since the attributes are missing
> only intermittently.
> 
> Is there another way to poke the attributes into the session before any
> callbacks are invoked?
> 
> In a previous impl (that I just got done ripping out last night) I would
> create a new instance of QuickfixProtoclHandler for each mina session.
> But I thought it would be cleaner to use the attibutes. Do I need to go
> back to the previous impl?
> 
> --
> barry kaplan
> groups1@memelet.com
> 



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/