Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Problem with Session Singleton
Problem with Session Singleton [message #73686] Wed, 13 February 2008 12:29 Go to next message
GAILLOT is currently offline GAILLOT
Messages: 15
Registered: July 2009
Junior Member
Hi,

A strange problem occurs with my Session Singleton objects :

For example, I have created a TableViewer in a viewPart which informs a
session singleton when the selection has changed.
Then my singleton notifies all its listeners that the selection has
changed as well. Here my listener is another viewPart which displays the
details of the selection.

All works fine, but I got a problem when i am doing the following actions
with Firefox:

- Launching the application : that's OK
- Then I go to another page on the browser. : OK
- Then I come back to the application by clicking on the "Previous page"
button of Firefox
- I got the application again, but I got some strange effects :

When my second viewPart is subscribing the session singleton in
createPartControl(), I have this code :

- ModelObjectSelection.getInstance().addSelectionListener(this );

When my TableViewer notify the SessionSingleton that the selection has
changed, I have the following code :

- ModelObjectSelection.getInstance().setSelectedModelObject(mo delObject);

But in debug mode, I noticed that the "ModelObjectSelection.getInstance()"
of those two lines does not return the same singleton.

The first line returns the singleton I had when I opened the application
the first time.
The second line returns a new singleton.
As a consequence, the second viewpart is never notified when there is a
selection change on the Table Viewer.

Apparently, I got this problem only when i launch the application by
clicking on "Previous page" or "Next Page" on the browser.
Looks like, the page has not been entirely reloaded.

Has anyone an idea ?

Thanks a lot for your help.

Cédric G.
Re: Problem with Session Singleton [message #73845 is a reply to message #73686] Thu, 14 February 2008 08:06 Go to previous messageGo to next message
Eclipse User
Originally posted by: fappel.innoopract.com

Hi,

this sounds indeed very strange. Even more as session singletons are
stored as attributes in the session store using a key that is derived
from the classname of the singleton class. Which means that there is
only one key under which both of the singleton instances you've
mentionend have to be retrieved from the session. So I can't provide an
explanation what's happening in you application right now. Maybe it's
possible for you to strip down the problem to a simple example project
which we can use to have a deeper look at it?


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: "Cédric" G. [mailto:ckgaillot@tiscali.fr]
Bereitgestellt: Mittwoch, 13. Februar 2008 13:30
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Problem with Session Singleton
Betreff: Problem with Session Singleton


Hi,

A strange problem occurs with my Session Singleton objects :

For example, I have created a TableViewer in a viewPart which informs a
session singleton when the selection has changed.
Then my singleton notifies all its listeners that the selection has
changed as well. Here my listener is another viewPart which displays the
details of the selection.

All works fine, but I got a problem when i am doing the following
actions with Firefox:

- Launching the application : that's OK
- Then I go to another page on the browser. : OK
- Then I come back to the application by clicking on the "Previous page"

button of Firefox
- I got the application again, but I got some strange effects :

When my second viewPart is subscribing the session singleton in
createPartControl(), I have this code :

- ModelObjectSelection.getInstance().addSelectionListener(this );

When my TableViewer notify the SessionSingleton that the selection has
changed, I have the following code :

-
ModelObjectSelection.getInstance().setSelectedModelObject(mo delObject);

But in debug mode, I noticed that the
"ModelObjectSelection.getInstance()"
of those two lines does not return the same singleton.

The first line returns the singleton I had when I opened the application
the first time.
The second line returns a new singleton.
As a consequence, the second viewpart is never notified when there is a
selection change on the Table Viewer.

Apparently, I got this problem only when i launch the application by
clicking on "Previous page" or "Next Page" on the browser.
Looks like, the page has not been entirely reloaded.

Has anyone an idea ?

Thanks a lot for your help.

Cédric G.
Re: Problem with Session Singleton [message #73900 is a reply to message #73845] Thu, 14 February 2008 08:31 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5434
Registered: July 2009
Senior Member
Doesn't the thing Cedric implemented can be achieved using the
SelectionService? I don't know RAP very well but in RCP it sounds he is
doing the same.

Tom

Frank Appel schrieb:
> Hi,
>
> this sounds indeed very strange. Even more as session singletons are
> stored as attributes in the session store using a key that is derived
> from the classname of the singleton class. Which means that there is
> only one key under which both of the singleton instances you've
> mentionend have to be retrieved from the session. So I can't provide an
> explanation what's happening in you application right now. Maybe it's
> possible for you to strip down the problem to a simple example project
> which we can use to have a deeper look at it?
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: "Cédric" G. [mailto:ckgaillot@tiscali.fr]
> Bereitgestellt: Mittwoch, 13. Februar 2008 13:30
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Problem with Session Singleton
> Betreff: Problem with Session Singleton
>
>
> Hi,
>
> A strange problem occurs with my Session Singleton objects :
>
> For example, I have created a TableViewer in a viewPart which informs a
> session singleton when the selection has changed.
> Then my singleton notifies all its listeners that the selection has
> changed as well. Here my listener is another viewPart which displays the
> details of the selection.
>
> All works fine, but I got a problem when i am doing the following
> actions with Firefox:
>
> - Launching the application : that's OK
> - Then I go to another page on the browser. : OK
> - Then I come back to the application by clicking on the "Previous page"
>
> button of Firefox
> - I got the application again, but I got some strange effects :
>
> When my second viewPart is subscribing the session singleton in
> createPartControl(), I have this code :
>
> - ModelObjectSelection.getInstance().addSelectionListener(this );
>
> When my TableViewer notify the SessionSingleton that the selection has
> changed, I have the following code :
>
> -
> ModelObjectSelection.getInstance().setSelectedModelObject(mo delObject);
>
> But in debug mode, I noticed that the
> "ModelObjectSelection.getInstance()"
> of those two lines does not return the same singleton.
>
> The first line returns the singleton I had when I opened the application
> the first time.
> The second line returns a new singleton.
> As a consequence, the second viewpart is never notified when there is a
> selection change on the Table Viewer.
>
> Apparently, I got this problem only when i launch the application by
> clicking on "Previous page" or "Next Page" on the browser.
> Looks like, the page has not been entirely reloaded.
>
> Has anyone an idea ?
>
> Thanks a lot for your help.
>
> Cédric G.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Problem with Session Singleton [message #73937 is a reply to message #73900] Thu, 14 February 2008 08:53 Go to previous messageGo to next message
Eclipse User
Originally posted by: fappel.innoopract.com

Hi,

I must admit that the thought occured to me, too. But as I'm not
familiar with Cedric's app I decided to focus on the singleton problem.
Since they are spread around all RAP apps I want to be sure that there
isn't a generell problem with this.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Tom Schindl [mailto:tom.schindl@bestsolution.at]
Bereitgestellt: Donnerstag, 14. Februar 2008 09:32
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Problem with Session Singleton
Betreff: Re: Problem with Session Singleton


Doesn't the thing Cedric implemented can be achieved using the
SelectionService? I don't know RAP very well but in RCP it sounds he is
doing the same.

Tom

Frank Appel schrieb:
> Hi,
>
> this sounds indeed very strange. Even more as session singletons are
> stored as attributes in the session store using a key that is derived
> from the classname of the singleton class. Which means that there is
> only one key under which both of the singleton instances you've
> mentionend have to be retrieved from the session. So I can't provide
> an explanation what's happening in you application right now. Maybe
> it's possible for you to strip down the problem to a simple example
> project which we can use to have a deeper look at it?
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: "Cédric" G. [mailto:ckgaillot@tiscali.fr]
> Bereitgestellt: Mittwoch, 13. Februar 2008 13:30 Bereitgestellt in:
> eclipse.technology.rap
> Unterhaltung: Problem with Session Singleton
> Betreff: Problem with Session Singleton
>
>
> Hi,
>
> A strange problem occurs with my Session Singleton objects :
>
> For example, I have created a TableViewer in a viewPart which informs
> a session singleton when the selection has changed.
> Then my singleton notifies all its listeners that the selection has
> changed as well. Here my listener is another viewPart which displays
> the details of the selection.
>
> All works fine, but I got a problem when i am doing the following
> actions with Firefox:
>
> - Launching the application : that's OK
> - Then I go to another page on the browser. : OK
> - Then I come back to the application by clicking on the "Previous
page"
>
> button of Firefox
> - I got the application again, but I got some strange effects :
>
> When my second viewPart is subscribing the session singleton in
> createPartControl(), I have this code :
>
> - ModelObjectSelection.getInstance().addSelectionListener(this );
>
> When my TableViewer notify the SessionSingleton that the selection has

> changed, I have the following code :
>
> -
> ModelObjectSelection.getInstance().setSelectedModelObject(mo delObject)
> ;
>
> But in debug mode, I noticed that the
> "ModelObjectSelection.getInstance()"
> of those two lines does not return the same singleton.
>
> The first line returns the singleton I had when I opened the
> application the first time.
> The second line returns a new singleton.
> As a consequence, the second viewpart is never notified when there is
> a selection change on the Table Viewer.
>
> Apparently, I got this problem only when i launch the application by
> clicking on "Previous page" or "Next Page" on the browser.
> Looks like, the page has not been entirely reloaded.
>
> Has anyone an idea ?
>
> Thanks a lot for your help.
>
> Cédric G.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Problem with Session Singleton [message #73972 is a reply to message #73937] Thu, 14 February 2008 13:00 Go to previous messageGo to next message
GAILLOT is currently offline GAILLOT
Messages: 15
Registered: July 2009
Junior Member
Hi,

Thanks for your answers.

I have created an example project with the singleton object that causes me
this problem and I got the same problem with it.

How can I send you that example project ?

Regards,

Cédric G.
Re: Problem with Session Singleton [message #74043 is a reply to message #73972] Thu, 14 February 2008 15:31 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin Muskalla
Messages: 237
Registered: July 2009
Senior Member
I think a bug report with the project attached is the best way to track
this.

Greets
Benny

Cédric G. wrote:
> Hi,
>
> Thanks for your answers.
>
> I have created an example project with the singleton object that causes
> me this problem and I got the same problem with it.
>
> How can I send you that example project ?
>
> Regards,
>
> Cédric G.
>
Re: Problem with Session Singleton [message #74079 is a reply to message #74043] Thu, 14 February 2008 17:38 Go to previous message
GAILLOT is currently offline GAILLOT
Messages: 15
Registered: July 2009
Junior Member
Hi,

I created a bug report and attached a test case.

Regards,

Cédric G.
Previous Topic:setBounds in Dialog
Next Topic:[ANN] Display#readAndDispatch
Goto Forum:
  


Current Time: Fri Oct 31 12:20:52 GMT 2014

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

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