The best results I have got so far were running threads (reading from SampleProviders and implementing SampleProvider interface) via scheduled thread pool executor (using single or two threads).
This allows you to filter (e.g.: mean) results polled at high frequency, while actual polling from your main thread is decoupled and can occur on less frequent basis.
SampleProvider mean = new MeanFilter(aSampleProvider, 10);
SampleProvider recentSample = new SampleThread(mean, 10);
// you can now fetch a recent sample mean from recentSample
Users browsing this forum: Google [Bot] and 3 guests