mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Trudeau" <strud...@bluetreewireless.com>
Subject RE: [Q] Resuming an IoSession after a disconnect
Date Mon, 26 May 2008 13:41:20 GMT
Are there any existing mechanics to do IoSession proxy currently built into mina? Thanks.


Simon 
-----Original Message-----
From: Niklas Therning [mailto:niklas@trillian.se] 
Sent: May-26-08 3:30 AM
To: users@mina.apache.org
Subject: Re: [Q] Resuming an IoSession after a disconnect

Couldn't you just update the cache with the new IoSession object when you have reconnected?

Another option could be to put a filter first in your chain which wraps your IoSession in
an IoSession proxy. The proxy object will never change, only the target IoSession it points
to (this is what you update when you reconnect). The cache would contain the proxy IoSession
objects. This is probably way overkill for you but could be quite elegant IMO. :-)

HTH

/Niklas

Simon Trudeau skrev:
> I managed to get it to work from the way I described at the bottom (I had a slight problem
with my logic, I was firing my retry too many times). My only problem is that I cannot reuse
the previous IoSession object. That would have been realy convinient for me since I cache
session object so I can reuse them when trying to transmit to an already connected host.
>
> Thanks,
>
>
> Simon
> -----Original Message-----
> From:  (Trustin Lee) [mailto:trustin@gmail.com]
> Sent: May-18-08 11:29 PM
> To: MINA Users
> Cc: Niklas Therning
> Subject: Re: [Q] Resuming an IoSession after a disconnect
>
> Niklas could answer your question probably.  Niklas?
>
> On Fri, 16 May 2008 10:24:13 +0900, Simon Trudeau <strudeau@bluetreewireless.com>
wrote:
>
>   
>> Yes I am.
>>
>> I have managed to reconnect by obtaining the ioService from the old 
>> session, connecting (ioconnector.connect) and obtain a new session. I 
>> populate my new session with my old session's attributes (including 
>> the state machine states) and then I can resume my processing without 
>> loosing where I was processing from. Still, one thing troubles me, it 
>> seems that my old session is not discarded and when an other 
>> disconnect event occurs, the old session's statemachine triggers and 
>> tries to handle the disconnect event! I wish the old session would 
>> get discarted.  It would greatly simplify my life if I could 
>> reconnect and resume my old session (I really don't know how to do 
>> that). What would you recommend to handle a statefull  reconnection? Thanks.
>>
>>
>> Simon
>> -----Original Message-----
>> From:  (Trustin Lee) [mailto:trustin@gmail.com]
>> Sent: May-15-08 5:04 PM
>> To: users@mina.apache.org
>> Subject: Re: [Q] Resuming an IoSession after a disconnect
>>
>> Hi Simon,
>>
>> Are you using MINA 2 statemachine module?
>>
>> On Wed, 14 May 2008 00:05:21 +0900, Simon Trudeau 
>> <strudeau@bluetreewireless.com> wrote:
>>
>>     
>>> I would like to know how to resume an IoSession after a disconnect.
>>> My application queries a server on port A using Mina.
>>> Answer from query triggers an FTP upload on port B. Depending on the 
>>> time it  takes to perform the FTP upload, the connection to A will 
>>> teminate (the remote host reboots due to the ftp upload to apply the 
>>> changes). And then I want to resume my session. How should I go 
>>> about doing that?
>>> I really want to resume my session since my transaction context are 
>>> stored in the session and because my code is structured around Mina 
>>> StateMachine, I don't want to loose the state I am in!
>>> Thanks,
>>> Simon
>>>       
>>
>> --
>> Trustin Lee - Principal Software Engineer, JBoss, Red Hat
>> --
>> what we call human nature is actually human habit
>> --
>> http://gleamynode.net/
>>     
>
>
>
> --
> Trustin Lee - Principal Software Engineer, JBoss, Red Hat
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
>   


Mime
View raw message