Community articleinvokeLater method
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

IBM® Forms Viewer only supports a single thread, but complex extensions may contain multiple threads. Use invokeLater to delay form updates from extensions until the Viewer has finished processing on the main thread.



IBM® Forms Viewer only supports a single thread, but complex extensions may contain multiple threads. Use invokeLater to delay form updates from extensions until the Viewer has finished processing on the main thread.

Method

   
   public static void invokeLater(Runnable theRunnable,)throws RuntimeException;


Parameters

ExpressionTypeDescription
theRunnableRunnableThe thread that you want to run when the Viewer main thread is free.


Returns

Nothing if call is successful or throws an exception (RuntimeException) if an error occurs.

Example

In the example below, invokeLater is called to manage the threads in an extension. In this case, some code running in another thread needs to set a field's value. To do this, the task is contained inside a Runnable and passed to invokeLater. Furthermore, as the Runnable interface does not allow any checked exceptions to be thrown, any UWIException needs to be rethrown as a RuntimeException.
   AsyncSupport.invokeLater(new Runnable()
	 {
	    public void run()
			   {
			   try
				 {
				    theForm.setLiteralByRefEx(null, "PAGE1.FIELD7.value", 0, null, 
               null, "Updated Value");
				 }
				 catch (UWIException ex)
				 
				    throw new RuntimeException(ex);
				 }
   }
   


Parent topic:
AsyncSupport class