Vincent,

Threading shouldn't be an issue in the Restlet processing chain, including
the leaf Handlers as all the call state is included in the Request/Response
instances which is not shared among multiple threads.

However, depending on the design you retain, you may have to consider
threading issues for your target Resources if you want to reuse them across
multiple calls. 

For example, if you use an object database or a shared cache of domain
objects, you need to synchronize access to your Resources to deal with
concurrent modification of their state. One particularly sensitive method is
the getVariants() one as each call to it would probably need to return a new
instance of each variant/representation. So, I don't see a need for
systematic synchronization of accesses to representations in the framework.

Best regards,
Jerome

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Vincent
> Envoyé : dimanche 5 novembre 2006 19:32
> À : [email protected]
> Objet : Re: toString shouldn't change the object's state
> 
> Thanks Jerome. 
> 
> 
> > 4) Caching is an important requirement that we will address 
> later, probably
> > at a higher level (as a CacheFilter or CacheService?). 
> There is a RFE for it
> > already:
> > http://restlet.tigris.org/issues/show_bug.cgi?id=25
> 
> Could you please shed some light on the threading question? 
> Piyush and John
> indicated that  Request.getValue must be synchronized should 
> we want to cache
> teh stringg, but I don't understand why. I must have missed 
> something in
> Restlet's threading model.
> 
> Thanks,
> 
> -Vincent.
> 
> > > 
> > > > The problem with cache invalidation for muttable objects in a
> > > > multithreaded environment isn't straightforward
> > > 
> > > Why would two threads access the same request?
> > > If it's the case, wouldn't we need to add proper 
> > > synchronization to the
> > > getStream method anyway? 
> > > 
> > >   public synchronized InputStream getStream() throws IOException
> > >   {
> > >           InputStream result = this.inputStream;
> > >           this.inputStream = null;
> > >           setAvailable(false);
> > >           return result;
> > >   } 
> 

Reply via email to