Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Fri, 24 December 2021 02:04 Go to next message
Manuel Mall is currently offline Manuel MallFriend
Messages: 26
Registered: September 2015
Junior Member
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 09:36 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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: Fri Jun 14 00:46:35 GMT 2024

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

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

Back to the top