In my app, when the user is done searching on one keyword, they click a link
which takes them back to the main search page. Thats the time when I wanted
the CometActor to stop. Otherwise there will be too many threads floating
around and performance will suffer.

On Mon, Oct 5, 2009 at 2:50 PM, David Pollak
<feeder.of.the.be...@gmail.com>wrote:

>
>
> On Mon, Oct 5, 2009 at 11:45 AM, Jack Widman <jack.wid...@gmail.com>wrote:
>
>> Interesting. I will try that. And I won't send any more ShutDownMessages
>> :)
>> Though I should add that each CometActor is doing a lot of processing. So
>> I it would be good if I could shut one down somehow when the user searches
>> on a new term. Timeout won't work because there is no way to know how long
>> it will take.
>>
>> Maybe I could just kill all the actors directly that are doing the
>> processing.
>>
>
> That's going to be even worse.  You'll kill something out from under
> Lift... it's going to cause a huge pile of pain.
>
> You can remove an Actor from the session and that will cause ShutDown to be
> sent to it, but depending on how the Actor was written it's not going to
> stop processing its mailbox.
>
> Bottom line... there's no way to tell if a user is not looking at a page
> with an Actor anymore.  The best way to deal with that is timing the Actor
> out.  It's going to take time (your timeout period), but it's the best way
> to do it.
>
>
>>
>> On Mon, Oct 5, 2009 at 2:40 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>>
>>>
>>> On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman <jack.wid...@gmail.com>wrote:
>>>
>>>> Understood. My intention is to send a ShutDown message to the CometActor
>>>> when somebody closes the browser. I need this so that when they visit the
>>>> page in a browser again, the CometActor is 'reset'.
>>>>
>>>>
>>> First, there's no way to determine if the browser window is closed.
>>>
>>> Second, *DO NOT* send a ShutDown message to the CometActor.  This is an
>>> internal Lift piece of housekeeping.  If you do this, you will break stuff.
>>>  Don't do it.  (There is a reason the message is not private, but it should
>>> not be used for this purpose.)
>>>
>>> CometActors can be named:
>>>
>>> <lift:comet type="Search" name={searchString}/>
>>>
>>> You can then have a separate CometActor for each searchString.  Voila...
>>> you get what you want.  Now, how do you make then CometActor go away when
>>> it's not being used anymore?
>>>
>>> In your CometActor:
>>>  override def lifespan: Box[TimeSpan] = Full(3 minutes)
>>>
>>> That means if a CometActor does not appear on a page for 3 minutes, it's
>>> removed from the session.  If the named CometActor is requested again, a new
>>> one will be created.
>>>
>>>
>>>
>>>>
>>>> On Mon, Oct 5, 2009 at 1:18 PM, marius d. <marius.dan...@gmail.com>wrote:
>>>>
>>>>>
>>>>> HTTP session termination does not equate with browser-close event.
>>>>>
>>>>> Br's,
>>>>> Marius
>>>>>
>>>>> On Oct 5, 3:22 pm, Jack Widman <jack.wid...@gmail.com> wrote:
>>>>> > Yes, thats what I meant. Thanks
>>>>> >
>>>>> > On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
>>>>> <timo...@getintheloop.eu>wrote:
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > > But you can do it on session termination (which is what you
>>>>> probably
>>>>> > > want):
>>>>> >
>>>>> > >
>>>>> http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
>>>>> ..
>>>>> >
>>>>> > > Checkout the method:
>>>>> >
>>>>> > > registerCleanupFunc
>>>>> >
>>>>> > > Cheers, Tim
>>>>> >
>>>>> > > On Oct 5, 8:54 am, Viktor Klang <viktor.kl...@gmail.com> wrote:
>>>>> > > > On Mon, Oct 5, 2009 at 6:50 AM, jack <jack.wid...@gmail.com>
>>>>> wrote:
>>>>> >
>>>>> > > > > I would like to call a function when the browser is closed. How
>>>>> do I
>>>>> > > > > do this?
>>>>> >
>>>>> > > > You cannot reliably do this.
>>>>> >
>>>>> > > > --
>>>>> > > > Viktor Klang
>>>>> >
>>>>> > > > Blog: klangism.blogspot.com
>>>>> > > > Twttr: viktorklang
>>>>> >
>>>>> > > > Lift Committer - liftweb.com
>>>>> > > > AKKA Committer - akkasource.org
>>>>> > > > Cassidy - github.com/viktorklang/Cassidy.git
>>>>> > > > SoftPub founder:http://groups.google.com/group/softpub
>>>>> >
>>>>> > --
>>>>> > Jack
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Jack
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Lift, the simply functional web framework http://liftweb.net
>>> Beginning Scala http://www.apress.com/book/view/1430219890
>>> Follow me: http://twitter.com/dpp
>>> Surf the harmonics
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Jack
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> >
>


-- 
Jack

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to