Hi,

   +-From: "Leis, Benjamin" <benl...@amazon.com> --
   |_Date: Tue, 14 Feb 2012 13:32:06 -0800 ________
   |
   |If you call channel.getInputStream() whose responsibility it to close
   |the returned InputStream. Looking through code, I could see that a new
   |outputstream is built against the inputstream and that looks like it
   |gets closed automatically when the channel is disconnected but is
   |the underlying InputStream handled as well or will it leak resources
   |if not explicitly closed?

The "channel.getInputStream()" will return an instance of 
java.io.PipedInputStream class.  Refer to its source code from Sun(Oracle),
  http://www.docjar.com/html/api/java/io/PipedInputStream.java.html

The "Channe#disconnect()" will cause the invocation of
PipedInputStream#receivedLast() via PipedOutputStream#close() .
It seems PipedInputStream#close() must not be invoked automatically,
but when its related PipedOutputStream is GCed, its resource will be also.
Do you have encountered resource leaks with Channel#getInputStream()  ?


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
Skype callto://jcraft/
Twitter: http://twitter.com/ymnk
Facebook: http://facebook.com/aymnk

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to