Skip to main content

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

Thanks Pawel,

 

I tried using it. It’s almost what I was looking for J

 

The only surprise I had was - I was expecting retrieve to be called only once. Once the cache is in a pending state I didn’t expect retrieve to be called again.

 

If you want you can move the discussion to the bug entry.

 

Regards

Dobrin

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Pawel Piech
Sent: July 23, 2009 3:17 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] DSF question

 

Hi Dobrin,
I started work on such a utility class in bug 249236.  I think there is room for a set of generic cache classes for storing simple data elements as well as lists of elements, and then also deal with per-context data in the way that command cache does.  In fact, I think it would be really good to refactor CommandCache using such building blocks, because its current implementation is overly complicated.

Cheers,
Pawel

Marc Khouzam wrote:

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx 
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Alexiev, Dobrin
Sent: Thursday, July 23, 2009 2:28 PM
To: CDT General developers list.
Subject: [cdt-dev] DSF question
 
Hello, 
 
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. 
    
 
I've used the very same pattern in the MIVariableManager class.
I believe your idea is the way to do things.
You can look at the element MIVariableManager.operationsPending,
and you will see it is very much like yours.
 
Marc
 
 
  
Thanks in advance. 
Dobrin
 
Class ServiceX 
  Data data = "">
  Boolean dataRequested = false;
  ArrayList< DataRequestMonitor<Data >> initRMs = 
ArrayList<                              DataRequestMonitor<Data >>();
 
  Public Void SerivceX.getData( RequestMonitor rm){
         if( data != null) {
                 rm.setData(data);      
                 rm.done();
         }
         else {
                 initRMs.add(rm); 
                 if( !dataRequested) {
                         dataRequested = true;
                         requestData();
                 }
         }
  }
 
  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) {
                 rm.setData(data);
                 rm.done();     
         }
 
 
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
 
    
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
  

 


Back to the top