Storing state in ChunkedStream

nio affi.steve at gmail.com
Mon Jul 4 04:38:31 EDT 2011


Hi All

Netty is great and I am quickly getting to grips with it. I have a question
on state:

In my ChannelPipelineFactory I create a new (HTTP based) Handler which I
understand will let me keep state within the handler itself. Now in my
handler I create a new instance of my own Class which extends ChunkedStream. 

In the overloaded ChunkedStream constructor I pass an additional parameter
which I save as an instance variable in the ChunkedStream instance. I use
this variable (which is the location of a file on the filesystem) in my
overloaded nextChunk () method to decide whether to add an artificial delay
or not. 

Is this a correct way to maintain state and will it be thread safe?

Thanks

--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Storing-state-in-ChunkedStream-tp6545338p6545338.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list