Loading the Custom Data Source on the Application Thread.

Loading the Custom Data Source on the Application Thread.

book

Article ID: KB0073702

calendar_today

Updated On:

Products Versions
Spotfire Analyst 10.10 and Higher

Description

Certain operations (for example : fetching custom preferences) in the CustomDataSource class gives an exception "Attempt to perform an operation on an incorrect thread. Use ApplicationThread.Invoke() to invoke into the application thread."


For such operations resulting in the above exception indicates that the data source should be loaded on the application thread.

Issue/Introduction

Certain operations for example fetching custom preferences using this.GetService< PreferenceManager >(serviceProvider) in the CustomDataSource class requires the caller to be on the application thread.

Environment

All Supported Operating Systems

Resolution

  • In Spotfire 10.10  there is an  API property "AlwaysLoadOnApplicationThread" in the CustomDataSource class that each implementer can override to load the data source on the application thread.
   
  • Note that setting the preference in the Administration Manager “LoadDataFromCustomDataSourcesOnApplicationThread”  also makes it achievable. However setting this preference does affect all custom data sources(which may not be a requirement and in turn affect those) and needs manual intervention to do it.
 
  • With the API capability there isn't any need to set the Preference at the central level in the Administration Manager. The AlwaysLoadOnApplicationThread property can be set to true(default is false) at the code level as per the use case.

Additional Information

https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/Index.aspx