Synchronizing HTTP Requests with Netty
michi
michi at cs.stanford.edu
Wed Oct 5 13:29:14 EDT 2011
Hello!
I'm writing a http-based static filer server using netty. It's very similar
to HttpStaticFileServerHandler example, but in addition to reading files, it
allows you to write files with PUT request. I'm trying to figure out how to
synchronize http requests so that readers don't see files while it's being
created.
My initial thought was to use ReentrantReadWriteLock. Reader acquires a
read-lock after receiving a request, and releases it in the
operationComplete() call back. Writer acquires a write-lock after receiving
a request, and releases it after receiving all the http chunks and writing
them to a file. However, somebody pointed out that this approach might not
work since ReentrantReadWriteLock allows a thread to get read-lock even if
the same thread already holds write-lock.
So my question is... what's the "netty" way of synchronizing http requests?
Thanks!
--Michi
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Synchronizing-HTTP-Requests-with-Netty-tp6863076p6863076.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list