Yes it's OK. You need to care for thread safety though, which will be
hard. The other problem is that changing the underlying data doesn't
necessarily invalidate caches above it. You'll have to consider that
part as well. I suppose this is part of why it was conceived as a
model where the data is only periodically re-read -- you gain speed
from immutability and cacheability. But you lose, of course, real-time
updates.

On Fri, Mar 29, 2013 at 5:46 PM, Ceyhun Can ÜLKER <[email protected]> wrote:
> Hello,
>
> I checked the implementation of GenericDataModel for adding and removing
> preferences after instantiation. Those methods (setPreference(long, long,
> float) and removePreference(long, long)) throw
> UnsupportedOperationException s. I'd like to know whether there is an
> important reason for not altering content of a GenericDataModel, since in
> our application data can fit into memory and we want our data to be up to
> date. DataModel interface have those methods, and GenericDataModel is just
> an in-memory implementation of it.
>
> Would it be ok if I write an implementation of DataModel like
> GenericDataModel, but with setPreference and removePreference methods not
> throwing exceptions?
>
> Thanks,
> Ceyhun Can ULKER

Reply via email to