Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] DSF question


I am starting to use DSF and here is a common usage pattern I'm trying to impalement. 

Multiple clients request a single piece of data that is asynchronously retrieved only once.
When the data is finally retrieved it is made available to all clients. 

I was wandering if there is a helper class I should use instead of writing my own.  Is there better way to achieve this?

Here is the sketch of what I want to achieve - far from elegant or synchronized. 

Thanks in advance. 

Class ServiceX 
	Data data = null;
	Boolean dataRequested = false;
	ArrayList< DataRequestMonitor<Data >> initRMs = ArrayList< 				DataRequestMonitor<Data >>();

	Public Void SerivceX.getData( RequestMonitor rm){
		if( data != null) {
		else {
			if( !dataRequested) {
				dataRequested = true;

	Void requstData( Context x) {
		Request the calls to the backend asyncronously.

	When the data is finally available on the backend OnDone callback:
		data = ...;
		for(DataRequestMonitor rm : initRMs) {

Back to the top