skip to main content
Programmer's documentation > Programming with JViews Maps > Creating a map application using the API > Using threads in data sources
 
Using threads in data sources
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at <installdir> /jviews-maps/samples/mapbuilder/index.html
The IlvTiledRasterDataSource, performs its start method in a separate thread if called from the Swing event dispatch thread. This is useful to know if you want to wait for the start method to finish. To do this, call the start method of the IlvTiledRasterDataSource from a different thread to the event thread to be sure it has completed as it returns.
For instance, to ensure that an IlvRasterDTEDDataSource has completed its start method, you could use the following code.
 
IlvMapDataSource DTEDDataSource;
...
// create reading thread
Thread loader = new Thread() {
    public void run() {
        DTEDDataSource.start();
    }
};
// start reading thread
loader.start();
// wait for the thread to complete
loader.join();

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.