You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Julien Vermillard <jv...@archean.fr> on 2006/07/20 18:14:34 UTC

reconnecting session and filterchains cleared when the session is closed

Hi,

After talking with Peter I'm trying to add reconnection features to
sockets. It's in the form of a reconnection() method in SocketConnector
for recycling a closed IoSession. It's a bit tricky but look like
working.

My last problem is why when the session is closed the filter chain is
cleared ? Because it preventing me to keep the inited filterchain after
a reconnection. 

Some solutions : 
 - remove the "session.getFilterChain().clear();" when the session is
closed
 - recall IoHandler.sessionCreated(...) when a session is reconnected.
normaly it will recreate the filterchain because  it's where everybody
puut the filter creation code.

The last solution can be confusing because a session can be created
multiple time..

WDYT ?

Julien

Re: reconnecting session and filterchains cleared when the session is closed

Posted by Trustin Lee <tr...@gmail.com>.
OK It's up and running now:

http://issues.apache.org/jira/browse/DIRMINA-68

HTH,
Trustin


On 7/21/06, Trustin Lee <tr...@gmail.com> wrote:
>
>  IIRC, there's a JIRA issue related with reconnection.  Why don't we
> continue the discussion there to keep our context more straightforward?  I
> want to give you the exact URL right now, but JIRA is down unfortunately.
> Let's check back when it's up again, and post each other's idea before
> implementing it, especially when this is the case that can affect the API.
>
> Trustin
>
>
>  On 7/21/06, Rob Butler <cr...@yahoo.com> wrote:
> >
> >
> >
> > --- Julien Vermillard <jv...@archean.fr> wrote:
> >
> > > Hi,
> > >
> > > After talking with Peter I'm trying to add
> > > reconnection features to
> > > sockets. It's in the form of a reconnection() method
> > > in SocketConnector
> > > for recycling a closed IoSession. It's a bit tricky
> > > but look like
> > > working.
> > >
> > > My last problem is why when the session is closed
> > > the filter chain is
> > > cleared ? Because it preventing me to keep the
> > > inited filterchain after
> > > a reconnection.
> > >
> > > Some solutions :
> > >  - remove the "session.getFilterChain().clear();"
> > > when the session is
> > > closed
> >
> > I would think this is more valid.
> >
> > >  - recall IoHandler.sessionCreated(...) when a
> > > session is reconnected.
> > > normaly it will recreate the filterchain because
> > > it's where everybody
> > > puut the filter creation code.
> >
> > This is not necessarily true.  It may be common
> > practice (and probably a bad one) but it is by no
> > means required.  I plan on using the various config
> > API's to setup everything outside the IoHandler.
> >
> > In my opinion (and I could be wrong, but it is my
> > opinion) everything should be setup and ready to go
> > before a client ever connects to the server.  The only
> > time you should modify the filter chain is if your
> > implementing something like startTLS or similar.
> >
> > >
> > > The last solution can be confusing because a session
> > > can be created
> > > multiple time..
> >
> > Yes, I would think it is confusing, and possibly wrong
> > simply if you think about when reconnect is called.
> > Reconnect is called when the client/server wishes to
> > reestablish a connection to the remote end.  Your
> > probably doing this because you were in the middle of
> > something and lost the connection.  If your not
> > creating an entirely new Iosession object then your
> > not really initiating a new session, your
> > re-establishing communication.  Thus, sessionCreated
> > probably shouldn't be called.
> >
> > Just my opinion.
> > Rob
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
>
> --
> PGP key fingerprints:
> * E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
> * B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: reconnecting session and filterchains cleared when the session is closed

Posted by Julien Vermillard <jv...@archean.fr>.
Ok continuing on jira. BTW don't worry it's a dummy implemntation for
see if the idea is working, not going to commit it as is. It helps me to
understand how SocketIoProcessor and rest works.

Julien

Le vendredi 21 juillet 2006 à 10:13 +0900, Trustin Lee a écrit :
> IIRC, there's a JIRA issue related with reconnection.  Why don't we continue
> the discussion there to keep our context more straightforward?  I want to
> give you the exact URL right now, but JIRA is down unfortunately.  Let's
> check back when it's up again, and post each other's idea before
> implementing it, especially when this is the case that can affect the API.
> 
> Trustin
> 
> 
> On 7/21/06, Rob Butler <cr...@yahoo.com> wrote:
> >
> >
> >
> > --- Julien Vermillard <jv...@archean.fr> wrote:
> >
> > > Hi,
> > >
> > > After talking with Peter I'm trying to add
> > > reconnection features to
> > > sockets. It's in the form of a reconnection() method
> > > in SocketConnector
> > > for recycling a closed IoSession. It's a bit tricky
> > > but look like
> > > working.
> > >
> > > My last problem is why when the session is closed
> > > the filter chain is
> > > cleared ? Because it preventing me to keep the
> > > inited filterchain after
> > > a reconnection.
> > >
> > > Some solutions :
> > >  - remove the "session.getFilterChain().clear();"
> > > when the session is
> > > closed
> >
> > I would think this is more valid.
> >
> > >  - recall IoHandler.sessionCreated(...) when a
> > > session is reconnected.
> > > normaly it will recreate the filterchain because
> > > it's where everybody
> > > puut the filter creation code.
> >
> > This is not necessarily true.  It may be common
> > practice (and probably a bad one) but it is by no
> > means required.  I plan on using the various config
> > API's to setup everything outside the IoHandler.
> >
> > In my opinion (and I could be wrong, but it is my
> > opinion) everything should be setup and ready to go
> > before a client ever connects to the server.  The only
> > time you should modify the filter chain is if your
> > implementing something like startTLS or similar.
> >
> > >
> > > The last solution can be confusing because a session
> > > can be created
> > > multiple time..
> >
> > Yes, I would think it is confusing, and possibly wrong
> > simply if you think about when reconnect is called.
> > Reconnect is called when the client/server wishes to
> > reestablish a connection to the remote end.  Your
> > probably doing this because you were in the middle of
> > something and lost the connection.  If your not
> > creating an entirely new Iosession object then your
> > not really initiating a new session, your
> > re-establishing communication.  Thus, sessionCreated
> > probably shouldn't be called.
> >
> > Just my opinion.
> > Rob
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> 
> 
> 

Re: reconnecting session and filterchains cleared when the session is closed

Posted by Trustin Lee <tr...@gmail.com>.
IIRC, there's a JIRA issue related with reconnection.  Why don't we continue
the discussion there to keep our context more straightforward?  I want to
give you the exact URL right now, but JIRA is down unfortunately.  Let's
check back when it's up again, and post each other's idea before
implementing it, especially when this is the case that can affect the API.

Trustin


On 7/21/06, Rob Butler <cr...@yahoo.com> wrote:
>
>
>
> --- Julien Vermillard <jv...@archean.fr> wrote:
>
> > Hi,
> >
> > After talking with Peter I'm trying to add
> > reconnection features to
> > sockets. It's in the form of a reconnection() method
> > in SocketConnector
> > for recycling a closed IoSession. It's a bit tricky
> > but look like
> > working.
> >
> > My last problem is why when the session is closed
> > the filter chain is
> > cleared ? Because it preventing me to keep the
> > inited filterchain after
> > a reconnection.
> >
> > Some solutions :
> >  - remove the "session.getFilterChain().clear();"
> > when the session is
> > closed
>
> I would think this is more valid.
>
> >  - recall IoHandler.sessionCreated(...) when a
> > session is reconnected.
> > normaly it will recreate the filterchain because
> > it's where everybody
> > puut the filter creation code.
>
> This is not necessarily true.  It may be common
> practice (and probably a bad one) but it is by no
> means required.  I plan on using the various config
> API's to setup everything outside the IoHandler.
>
> In my opinion (and I could be wrong, but it is my
> opinion) everything should be setup and ready to go
> before a client ever connects to the server.  The only
> time you should modify the filter chain is if your
> implementing something like startTLS or similar.
>
> >
> > The last solution can be confusing because a session
> > can be created
> > multiple time..
>
> Yes, I would think it is confusing, and possibly wrong
> simply if you think about when reconnect is called.
> Reconnect is called when the client/server wishes to
> reestablish a connection to the remote end.  Your
> probably doing this because you were in the middle of
> something and lost the connection.  If your not
> creating an entirely new Iosession object then your
> not really initiating a new session, your
> re-establishing communication.  Thus, sessionCreated
> probably shouldn't be called.
>
> Just my opinion.
> Rob
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: reconnecting session and filterchains cleared when the session is closed

Posted by Rob Butler <cr...@yahoo.com>.

--- Julien Vermillard <jv...@archean.fr> wrote:

> Hi,
> 
> After talking with Peter I'm trying to add
> reconnection features to
> sockets. It's in the form of a reconnection() method
> in SocketConnector
> for recycling a closed IoSession. It's a bit tricky
> but look like
> working.
> 
> My last problem is why when the session is closed
> the filter chain is
> cleared ? Because it preventing me to keep the
> inited filterchain after
> a reconnection. 
> 
> Some solutions : 
>  - remove the "session.getFilterChain().clear();"
> when the session is
> closed

I would think this is more valid.

>  - recall IoHandler.sessionCreated(...) when a
> session is reconnected.
> normaly it will recreate the filterchain because 
> it's where everybody
> puut the filter creation code.

This is not necessarily true.  It may be common
practice (and probably a bad one) but it is by no
means required.  I plan on using the various config
API's to setup everything outside the IoHandler.

In my opinion (and I could be wrong, but it is my
opinion) everything should be setup and ready to go
before a client ever connects to the server.  The only
time you should modify the filter chain is if your
implementing something like startTLS or similar.

> 
> The last solution can be confusing because a session
> can be created
> multiple time..

Yes, I would think it is confusing, and possibly wrong
simply if you think about when reconnect is called. 
Reconnect is called when the client/server wishes to
reestablish a connection to the remote end.  Your
probably doing this because you were in the middle of
something and lost the connection.  If your not
creating an entirely new Iosession object then your
not really initiating a new session, your
re-establishing communication.  Thus, sessionCreated
probably shouldn't be called.

Just my opinion.
Rob

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com