RCP to RAP problem with Singleton [message #530422] |
Thu, 29 April 2010 15:37 |
Dove Messages: 2 Registered: April 2010 |
Junior Member |
|
|
Hello, I would really appreciate help with problem I'm having.
I followed instructions for use singleton in RAP from http://wiki.eclipse.org/RAP/FAQ#What_is_a_Session_Singleton_ and_how_can_I_implement_one.3F
So my code from non-UI thread looks now:
final Display display = Display.getCurrent();
public void run() {
UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() {
public void run() {
Session session = Session.getInstance();
// do something with the session singleton
// cekani na pripojeni
while (!session.isConnected()) {
When i try to run it i am getting this message:
Exception in thread "Thread-8" java.lang.IllegalStateException: No context available outside of the request service lifecycle.
at org.eclipse.rwt.internal.service.ContextProvider.getContext(ContextProvider.java:108)
at org.eclipse.rwt.internal.service.ContextProvider.getStateInfo(ContextProvider.java:166)
at org.eclipse.rwt.SessionSingletonBase.getInstance(SessionSingletonBase.java:84)
at chess.model.Session.getInstance(Session.java:61)
at chess.parsers.GameParser.run(GameParser.java:44)
Exception in thread "Thread-6" java.lang.NullPointerException
at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.getDisplayAdapter(UICallBackServiceHandler.java:549)
at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.runNonUIThreadWithFakeContext(UICallBackServiceHandler.java:452)
at org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeContext(UICallBack.java:44)
at chess.parsers.SoughtParser.run(SoughtParser.java:44)
I cant find any help for the second exception. I would really appreciate help with this problem.
Thanks in Advance.
Problem solved. I was creating this non-UI thread from Activator. When i am creating this from Application then there is not this problem anymore.
[Updated on: Thu, 29 April 2010 17:06] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.27885 seconds