I am looking at the example code "SyncDataViewer" which is about DSF
Query object from the "Introduction to Programming vith DSF" tutorial.
// Create the query object for reading data count.
Query<Integer> countQuery = new Query<Integer>() {
@Override
protected void execute(DataRequestMonitor<Integer> rm) {
fDataGenerator.getCount(rm);
}
};
// Submit the query to be executed. A query implements a runnable
// interface and it has to be executed in order to do its work.
ImmediateExecutor.getInstance().execute(countQuery);
int count = 0;
// Block until the query completes, which will happen when the request
// monitor of the execute() method is marked done.
try {
count = countQuery.get();
} catch (Exception e) {
// InterruptedException and ExecutionException can be thrown here.
// ExecutionException containing a CoreException will be thrown
// if an error status is set to the Query's request monitor.
return new Object[0];
}
I could not understand that how countQuery.get(); method gets the count value. Because in IDataGeneration interface getCount method returns void such as:
// Data access methods.
void getCount(DataRequestMonitor<Integer> rm);
|