From: Ype K. <yk...@xs...> - 2003-03-10 18:31:27
|
Christof, ... > >the problem is that during concurrent requests the parameters are getting mixed up, so that user A requesting a page with the parameter alias=x gets the page from user B who requests the same page with parameter alias=y. >i guess the problem lies in the lines > >#set XSL > self.setXSLParameter('alias', alias) > self.setXSLParameter('series', series) > self.setXSLParameter('photo', photo) > #output > res.contentType = 'text/html' > self.trans.transform(self.xml, StreamResult(res.outputStream)) > >in java i would synchronize this block of statements, but how do i do this in jython as there is no synchronizing? >i am not a java nor jython pro as you might see and i reckon there are also solutions without synchronizing. > >any help would be great! I don't know about servlets, so I can't comment on that. To get synchronisation, you can use a Lock from the thread module: from thread import Lock in: __init__(self): add: self.lock = Lock() and around your block: self.lock.acquire() try: 'your block' finally: self.lock.release() When you need fifo behaviour on the acquire() call have a look at the FIFOSemaphore from util.concurrent by Doug Lea: http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html Have fun, Ype -- |