Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Is there a simple way to create a fake context?
Is there a simple way to create a fake context? [message #1848930] Thu, 23 December 2021 21:04 Go to next message
Eclipse UserFriend
We like to run some scheduled background processes (in this case using the Quartz library, but that doesn't really matter) in our RAP application. As those background jobs will use some shared code they require a RAP Context to avoid SingletonUtil.getSessionInstance() throwing an exception like this:
java.lang.IllegalStateException: Invalid thread access
	at org.eclipse.rap.rwt.RWT.checkContext(RWT.java:704)
	at org.eclipse.rap.rwt.RWT.getUISession(RWT.java:588)
	at org.eclipse.rap.rwt.SingletonUtil.getSessionInstance(SingletonUtil.java:58)

Our requirement is similar to the problem the TestContext class solves. However, the TestContext class relies heavily on RWT internal non public APIs therefore just copying the code (it needs modifications to remove the dependency on JUnit) causes access issues in an OSGi environment. Are there solutions to this using public RAP RWT APIs?
Re: Is there a simple way to create a fake context? [message #1849138 is a reply to message #1848930] Wed, 05 January 2022 04:36 Go to previous message
Eclipse UserFriend
Hi Manuel,

if you want to execute a code in the UI thread you can use:

RWT.getUISession(display).exec(runnable);

Also take a look at the Threads topic in RAP Developers Guide [1].

[1] https://www.eclipse.org/rap/developers-guide/devguide.php?topic=threads.html&version=3.19

HTH,
Ivan
Previous Topic:RAP e4 war export in Maven
Next Topic: electronic signature
Goto Forum:
  


Current Time: Tue Jul 08 21:14:15 EDT 2025

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

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

Back to the top