AsynchronousSocketChannel.shutdownInput()
Gili
cowwoc at bbs.darktech.org
Sat Aug 1 13:44:35 PDT 2009
Alexander Libman wrote:
>
> 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.
>
The problem is that write() returns the number of bytes written.
shutdownOutput() would only make sense if it returned an Integer (indicate
the number of bytes written) instead of returning the channel.
Alexander Libman wrote:
>
> 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.
>
Interesting point. Perhaps there should be a configuration option that
indicates whether close() is recursive?
Alexander Libman wrote:
>
> 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?
>
I like the idea of collaborating on this work and the idea of moving
readLine() into AsynchronousScanner, but I'm afraid that the last time I
took a look at your framework I was a little put off by the lack of
source-code comments and Javadoc. If you take a look at
http://projectkenai.com/projects/jperipheral/sources you will notice that I
went out of my way to document heavily (in fact, I will probably add more in
the future).
If we can find a way to work together, great. Otherwise, you are always
welcome to "borrow" some of my code as I am using the Apache license.
Cheers,
Gili
--
View this message in context: http://n2.nabble.com/AsynchronousSocketChannel.shutdownInput%28%29-tp3365782p3370579.html
Sent from the nio-discuss mailing list archive at Nabble.com.
More information about the nio-discuss
mailing list