AsynchronousSocketChannel.shutdownInput()
Alexander Libman
libman at terabit.com.au
Fri Jul 31 23:06:48 PDT 2009
Hi Gili,
shutdownOutput () signals the other side the end of stream
So asynch read completed (not failed) with the value of read bytes equal
to -1.
Example, where shutdownOutput is useful is AsynchoronousSSLChanel (also a
filter similar to AsynchronousCoder).
Implementation initiates graceful final handshake.
I looked at your version of AsynchronousCharByteChannel.
BTW, it is another, example where shutdowOutput() can be used instead of
method write(CharBuffer source, boolean endOfInput)
I think shutdownOutput() provides more consistent interface.
Terabit's AsynchronousCoder uses shutdownOutput() for graceful encoding
final step.
Also there are some cases (not very often) when the closure of external
channel (filter itself) should not close
the embedded(internal) channel. Assume we want to write
AsynchronousSMTPClient.
It can be implemented via the following stack of asynch. filters:
AsynchronousByteChannel
|
AsynchronousCharChannel
|
AsynchronousSMTPChannel
AsychronousSMTPChannel "rents" the underline channels to do a SMTP
transaction:
MailFrom, RcptTo,..., Body
After transactions is completed successfully, SMTP channel can be closed,
but
AsynchronousCharChannel can be reused for the next SMTP transaction.
Would you mind to join our effords to facilitate Asynchronous Filter
Framework?
What do you think about splitting functionality of "Asynchronous Char Line
Reader" (i.e. your implementation ) into two filters AsynchronousCoder and
AsynchronousScanner?
The first one will do only read/write CharBuffers and the second can be
generic AsynchronousScanner similar to Scanner?
Alex
> -----Original Message-----
> From: nio-discuss-bounces at openjdk.java.net
> [mailto:nio-discuss-bounces at openjdk.java.net]On Behalf Of Gili
> Sent: Friday, July 31, 2009 8:44 PM
> To: nio-discuss at openjdk.java.net
> Subject: AsynchronousSocketChannel.shutdownInput()
>
>
>
> Hi,
>
> Just curious, what's the point of shutdownInput() and shutdownOutput() in
> AsynchronousSocketChannel? When would users want to shut them as
> opposed to
> closing the entire channel?
>
> Thanks,
> Gili
> --
> View this message in context:
> http://n2.nabble.com/AsynchronousSocketChannel.shutdownInput%28%29
-tp3365782p3365782.html
Sent from the nio-discuss mailing list archive at Nabble.com.
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.38/2274 - Release Date: 07/31/09
05:58:00
More information about the nio-discuss
mailing list