Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » freeing resources exiting SWT
freeing resources exiting SWT [message #61596] Wed, 21 November 2007 20:07 Go to next message
Andrej Dimic is currently offline Andrej DimicFriend
Messages: 77
Registered: July 2009
Member
Hello

i have got 2 questions regarding freeing session memory.

first:
how to assure that critical Memory (i.e database connections, streams,
image memory) will be freed when the user closes the browser or types in a
new url?

at the moment we use code like this but this Listener is only triggered
when the user leaves the rap application by closing the main rwt/swt
window.

shell.addListener(SWT.Close, new Listener() {
public void handleEvent(Event event) {
((TableViewerTab)tabs[0]).closeCursor();
((TableViewerTab)tabs[1]).closeCursor();
dbObj.DbDisconnect(dbName);
dbGraphObj.DbDisconnect(dbGraphicsName);
dbObj=null;
dbGraphObj=null;
}
});

this leads me directly to question two:
is there a possibility to hide the browser when starting a rap application
so that only the rap application is visible?
I have seen such behavior with Zyxel CNM (a network management tool),
which loads a java applet (i guess) and then the browser disappears.

Thanks
Andrej
Re: freeing resources exiting SWT [message #61768 is a reply to message #61596] Thu, 22 November 2007 08:29 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Andrej,

you can use a SessionStoreListener to get notified when before the
session is destroyed. This normally happens when the user leaves the
page or a session timeout occurs.

You access it like that:

RWT.getSessionStore().addSessionStoreListener(new
SessionStoreListener() { public void beforeDestroy(SessionStoreEvent
event){
//
}
}

To your second question: I don't think that its possible to "hide" the
browser without any additional tools (which the user has to download).
However you can open your application in a very slim browser window
where you can hide the browser's toolbars, menus, and all that stuff by
redirecting.

Regards,
Stefan.


Andrej Dimic schrieb:
> Hello
>
> i have got 2 questions regarding freeing session memory.
>
> first:
> how to assure that critical Memory (i.e database connections, streams,
> image memory) will be freed when the user closes the browser or types in
> a new url?
>
> at the moment we use code like this but this Listener is only triggered
> when the user leaves the rap application by closing the main rwt/swt
> window.
>
> shell.addListener(SWT.Close, new Listener() {
> public void handleEvent(Event event) {
> ((TableViewerTab)tabs[0]).closeCursor();
> ((TableViewerTab)tabs[1]).closeCursor();
> dbObj.DbDisconnect(dbName);
> dbGraphObj.DbDisconnect(dbGraphicsName);
> dbObj=null;
> dbGraphObj=null;
> }
> });
>
> this leads me directly to question two:
> is there a possibility to hide the browser when starting a rap
> application so that only the rap application is visible?
> I have seen such behavior with Zyxel CNM (a network management tool),
> which loads a java applet (i guess) and then the browser disappears.
>
> Thanks
> Andrej
>
>
Antw: Re: freeing resources exiting SWT [message #61792 is a reply to message #61768] Thu, 22 November 2007 09:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: admin.kabe-farben.ch

Hi Stefan

thank you for your info information regarding SessionStore. This will solve
my problem.

what do you mean with "redirecting"?

Thank you
Andrej


>>> Stefan Röck<stefan.roeck@cas.de> schrieb am 22.11.2007 um 09:29 in
Nachricht <fi3ekm$683$1@build.eclipse.org>:
> Hi Andrej,
>
> you can use a SessionStoreListener to get notified when before the
> session is destroyed. This normally happens when the user leaves the
> page or a session timeout occurs.
>
> You access it like that:
>
> RWT.getSessionStore().addSessionStoreListener(new
> SessionStoreListener() { public void beforeDestroy(SessionStoreEvent
> event){
> //
> }
> }
>
> To your second question: I don't think that its possible to "hide" the
> browser without any additional tools (which the user has to download).
> However you can open your application in a very slim browser window
> where you can hide the browser's toolbars, menus, and all that stuff by
> redirecting.
>
> Regards,
> Stefan.
>
>
> Andrej Dimic schrieb:
>> Hello
>>
>> i have got 2 questions regarding freeing session memory.
>>
>> first:
>> how to assure that critical Memory (i.e database connections, streams,
>> image memory) will be freed when the user closes the browser or types in

>
>> a new url?
>>
>> at the moment we use code like this but this Listener is only triggered
>> when the user leaves the rap application by closing the main rwt/swt
>> window.
>>
>> shell.addListener(SWT.Close, new Listener() {
>> public void handleEvent(Event event) {
>> ((TableViewerTab)tabs[0]).closeCursor();
>> ((TableViewerTab)tabs[1]).closeCursor();
>> dbObj.DbDisconnect(dbName);
>> dbGraphObj.DbDisconnect(dbGraphicsName);
>> dbObj=null;
>> dbGraphObj=null;
>> }
>> });
>>
>> this leads me directly to question two:
>> is there a possibility to hide the browser when starting a rap
>> application so that only the rap application is visible?
>> I have seen such behavior with Zyxel CNM (a network management tool),
>> which loads a java applet (i guess) and then the browser disappears.
>>
>> Thanks
>> Andrej
>>
>>
Re: Antw: Re: freeing resources exiting SWT [message #61865 is a reply to message #61792] Thu, 22 November 2007 09:23 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Andrej Dimic schrieb:
> Hi Stefan
>
> thank you for your info information regarding SessionStore. This will solve
> my problem.
>
> what do you mean with "redirecting"?
>
> Thank you
> Andrej


What I meant is that you can give your users a URL to an empty HTML page
which uses JavaScript to open a second browser window without toolbar,
menues, etc.

Btw, Prism (http://labs.mozilla.com/2007/10/prism/) is an interesting
aproach to get rid of the browser and to call web applications by
clicking an icon on the users desktop.


Regards,
Stefan.
Re: freeing resources exiting SWT [message #61889 is a reply to message #61768] Thu, 22 November 2007 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

Hi stefan!

i put these lines in the preWindowOpen() method just to test is:

RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener() {
public void beforeDestroy(SessionStoreEvent event){
System.out.println("Session destroyed.");
}
});

but it seems that the method is never called, i tried to change the url,
closed the app and closed the browser, no println =).

is this method called in your app for example?
Re: freeing resources exiting SWT [message #62120 is a reply to message #61889] Thu, 22 November 2007 13:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

running RAP in self-hosting mode doesn't use a session timeout by default.
So the sessions don't get invalidated. You can use the VM argument
'org.eclipse.equinox.http.jetty.context.sessioninactiveinter val' to
configure a session timeout in your launch configuration. Doing so the
SessionStoreListener#beforeDestroy will be called by those sessions that get
invalidated due to long inactivity.

Ciao
Frank

"Ben W." <benjamin.wolff@web.de> schrieb im Newsbeitrag
news:64c049349af2c8f66d800ae7df62a604$1@www.eclipse.org...
> Hi stefan!
>
> i put these lines in the preWindowOpen() method just to test is:
>
> RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener()
> { public void beforeDestroy(SessionStoreEvent event){
> System.out.println("Session destroyed.");
> }
> });
>
> but it seems that the method is never called, i tried to change the url,
> closed the app and closed the browser, no println =).
>
> is this method called in your app for example?
>
Antw: Re: freeing resources exiting SWT [message #62168 is a reply to message #62120] Thu, 22 November 2007 14:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: admin.kabe-farben.ch

Hi

our deployment platform will be tomcat. What settings are required that the
SessionStoreListener will be called.

Thanks
Andrej


>>> Frank Appel<fappel@innoopract.com> schrieb am 22.11.2007 um 14:32 in
Nachricht <fi40cr$cov$1@build.eclipse.org>:
> Hi,
>
> running RAP in self-hosting mode doesn't use a session timeout by
> default.
> So the sessions don't get invalidated. You can use the VM argument
> 'org.eclipse.equinox.http.jetty.context.sessioninactiveinter val' to
> configure a session timeout in your launch configuration. Doing so the
> SessionStoreListener#beforeDestroy will be called by those sessions that
> get
> invalidated due to long inactivity.
>
> Ciao
> Frank
>
> "Ben W." <benjamin.wolff@web.de> schrieb im Newsbeitrag
> news:64c049349af2c8f66d800ae7df62a604$1@www.eclipse.org...
>> Hi stefan!
>>
>> i put these lines in the preWindowOpen() method just to test is:
>>
>> RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener()

>
>> { public void beforeDestroy(SessionStoreEvent event){
>> System.out.println("Session destroyed.");
>> }
>> });
>>
>> but it seems that the method is never called, i tried to change the url,

>
>> closed the app and closed the browser, no println =).
>>
>> is this method called in your app for example?
>>
Re: Re: freeing resources exiting SWT [message #62192 is a reply to message #62168] Thu, 22 November 2007 15:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

on Tomcat or any other JEE servlet container you can use the web.xml to set
the session timeout as usual. I was just talking about running RAP from
eclipse IDE at development time to explain why no session timeout occurs in
that case.

Ciao
Frank


"Andrej Dimic" <admin@kabe-farben.ch> schrieb im Newsbeitrag
news:47459FC5.8808.0090.0@kabe-farben.ch...
> Hi
>
> our deployment platform will be tomcat. What settings are required that
> the
> SessionStoreListener will be called.
>
> Thanks
> Andrej
>
>
>>>> Frank Appel<fappel@innoopract.com> schrieb am 22.11.2007 um 14:32 in
> Nachricht <fi40cr$cov$1@build.eclipse.org>:
>> Hi,
>>
>> running RAP in self-hosting mode doesn't use a session timeout by
>> default.
>> So the sessions don't get invalidated. You can use the VM argument
>> 'org.eclipse.equinox.http.jetty.context.sessioninactiveinter val' to
>> configure a session timeout in your launch configuration. Doing so the
>> SessionStoreListener#beforeDestroy will be called by those sessions that
>> get
>> invalidated due to long inactivity.
>>
>> Ciao
>> Frank
>>
>> "Ben W." <benjamin.wolff@web.de> schrieb im Newsbeitrag
>> news:64c049349af2c8f66d800ae7df62a604$1@www.eclipse.org...
>>> Hi stefan!
>>>
>>> i put these lines in the preWindowOpen() method just to test is:
>>>
>>> RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener()
>
>>
>>> { public void beforeDestroy(SessionStoreEvent event){
>>> System.out.println("Session destroyed.");
>>> }
>>> });
>>>
>>> but it seems that the method is never called, i tried to change the url,
>
>>
>>> closed the app and closed the browser, no println =).
>>>
>>> is this method called in your app for example?
>>>
Re: freeing resources exiting SWT [message #62216 is a reply to message #62192] Thu, 22 November 2007 15:20 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Frank Appel schrieb:
> Hi,
>
> on Tomcat or any other JEE servlet container you can use the web.xml to set
> the session timeout as usual. I was just talking about running RAP from
> eclipse IDE at development time to explain why no session timeout occurs in
> that case.
>
> Ciao
> Frank
>

At the moment (CVS Head from last friday), this doesn't even work in
Tomcat - but it did before :-)
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=210520
Re: freeing resources exiting SWT [message #62406 is a reply to message #62216] Fri, 23 November 2007 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I did not have the time to check this yet, but I think that's something
different. In this thread I mentioned the session timeout which means the
time that passes with no user activity (requests) before a session gets
invalidated. As far as I can see the latest changes on that mechanism had
been in september, so it should still work. There's no guarantee (and there
never was) that a session gets invalidated immediately on closing the
browser window, since not all browsers support this. But we will have a look
at it, whether it's possible to reintroduce this for the browsers that
support this mechanism. It actually was only a side-effect of the
multiple-client-detection that has been rewritten and changed in behavior,
see bug #207056.

Ciao
Frank


"Stefan R
Re: freeing resources exiting SWT [message #62429 is a reply to message #62406] Fri, 23 November 2007 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hm, but when you set the exitConfirmation in the branding there is a
confirm dialog that pops up if you try to change the url or close the
browser. may there is a possibility to hook up in this listener?!
Re: freeing resources exiting SWT [message #62496 is a reply to message #62429] Fri, 23 November 2007 11:40 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

that's exactly what we were doing. Unfortunately this didn't work with all
browsers (e.g. Safari, Opera). So with FF and IE we would at least address
most the clients...


Ciao
Frank


"Ben W." <benjamin.wolff@web.de> schrieb im Newsbeitrag
news:50c1a14f17c3f5271f46f337da800c33$1@www.eclipse.org...
> hm, but when you set the exitConfirmation in the branding there is a
> confirm dialog that pops up if you try to change the url or close the
> browser. may there is a possibility to hook up in this listener?!
>
Previous Topic:How to download file from RAP
Next Topic:Perspective Text is cut off
Goto Forum:
  


Current Time: Tue Sep 24 02:43:34 GMT 2024

Powered by FUDForum. Page generated in 0.04504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top