Hi,
the methods mentioned above in 2.1snapshot-jse all use a similar approach:
An extra thread is started that writes a representation to a pipe's sink and
the pipe's source is returned.
In a server environment where representations are not only served
statically, but processed in one way or another (cached to disk,
reformatted, analysed, accumulated etc.) while being sent to the client
these methods are used heavily.
BTW, we try to avoid the BioUtils methods as the NioUtils is using the >10x
faster PipeChannel.
My suggestion is to modify the extra thread's run() method to
SomeWriter writer = null
try {
writer = pipesink
representation.write(writer)
} catch(IOException e) {
log e
} finally {
try { representiaton.exhaust } catch (Exception e) {}
try { representiaton.release} catch (Exception e) {}
try { if (null != writer) writer.close } catch (Exception e) {}
}
I think this could reduce the risk of resource leaks (threads, sockets).
Guido Schmidt.
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/Suggestion-modify-B-N-ioUtils-getChannel-Stream-Reader-tp5981336p5981336.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2701834