[jbosscache-dev] Usage of Option override

Manik Surtani manik at jboss.org
Thu Aug 31 06:10:50 EDT 2006


cache_.getInvocationContext().getOptionOverrides 
().setForceDataGravitation(true);
Object obj = cache_.get(fqn, key);
cache_.getInvocationContext().getOptionOverrides 
().setForceDataGravitation(false);

Guaranteed not to get a null when you call getInvocationContext() or  
getOptionOverrides().
--
Manik Surtani

Lead, JBoss Cache
JBoss, a division of Red Hat

Email: manik at jboss.org
Telephone: +44 7786 702 706
MSN: manik at surtani.org
Yahoo/AIM/Skype: maniksurtani


On 31 Aug 2006, at 08:24, Ben Wang wrote:

> Manik,
>
> Maybe I have missed something here. But what's the best usage of  
> overriding the Option in 2.0? Currently, I have to do like:
>
>          gravitateOption_.setForceDataGravitation(true);
>          cache_.getInvocationContext().setOptionOverrides 
> (gravitateOption_);
>          Object obj = cache_.get(fqn, key);
>          gravitateOption_.setForceDataGravitation(false);
>          cache_.getInvocationContext().setOptionOverrides 
> (gravitateOption_);
>          return obj;
>
> Of which is painful. I can use getOptionOverrides to retrieve the  
> option and set it there. However, should I also check for nullity  
> there?
>
> Thanks,
>
> -Ben
>
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev




More information about the jbosscache-dev mailing list