You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Ceyhun Can ÜLKER <ce...@gmail.com> on 2013/03/29 18:46:51 UTC

Setting preferences in GenericDataModel.

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

Re: Setting preferences in GenericDataModel.

Posted by Ceyhun Can ÜLKER <ce...@gmail.com>.
I understand. Thank you for the heads-up.

Have a good day.
Ceyhun Can ULKER


On Fri, Mar 29, 2013 at 8:22 PM, Sean Owen <sr...@gmail.com> wrote:

> 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 <ce...@gmail.com>
> 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
>

Re: Setting preferences in GenericDataModel.

Posted by Sean Owen <sr...@gmail.com>.
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 <ce...@gmail.com> 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