| Singletons in RAP [message #58430] | 
Wed, 07 November 2007 13:03   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: andy.freenet.de 
 
Hi, 
 
I have an Application which uses a Singleton "ServiceLocator". 
This class extends "SessionSingletonBase", I read this is the  
right way to handle Singletons in a RAP Environment. 
 
Well, it seems that is isnŽt. 
When I try to access the Singleton-Instance I get the Exception 
java.lang.IllegalStateException: No context available outside of the  
request service lifecycle. 
 
Ok, I think the error is, that no session-context is available at the time  
when I call it. 
But how is this problem to be solved? 
 
Best regards! 
 
Andy
 |  
 |  
  | 
 | 
 | 
| Re: Singletons in RAP [message #58706 is a reply to message #58562] | 
Thu, 08 November 2007 09:35   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: fappel.innoopract.com 
 
Hi Andy, 
 
just a little excerpt of a discussion regarding the usage of session  
singletons and background threads that may brings a little more light at  
this: 
 
[...]To describe it in modelling terms, the relationship from background  
thread to UI (session) in RCP is an 1 to 1 relationship as in RAP it is an 1  
to n. Handling this difference can not be done under the hood of RAP, since  
the backround job cannot access implicitly the one and only UI-session as in  
RCP (e.g. by calling Display#getDefault()). [...] 
 
 
Ciao 
Frank 
 
 
"Andy" <andy@freenet.de> schrieb im Newsbeitrag  
news:cb110d78474d19f18bd6c20ab96a114a$1@www.eclipse.org... 
> Hi Andy, 
> you were right, this was exactly the reason. 
> Access to a SessionSingletonBase inside of a Job (or any Background-Thread  
> running on the Server I suppose) gives a IllegalStateException. 
> But what exactly is the reason for this? 
> I dont get the Point at the moment, perhaps you could describe shortly or  
> point me to the right direction? 
> 
> Thank you 
> 
> Andy 
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.24393 seconds