The CompletionHandler<V,A> Interface in Asynchronous context

Alan Bateman Alan.Bateman at Sun.COM
Thu Nov 12 05:26:48 PST 2009


向雅 wrote:
> :
> No:)
> I mainly mean I dont think it as a great way that all code write
> result ==-1? check.
> Everybody do the check, Everybody run the check, some waste:)
> some like the // signs case in protocol url.
> so the additional method out.
>
> About the bytecount read not report, look-seems I ever got. And I run
> again some test,  not found unreport case.
> from the code, I found:
>  my complete method have a comment:
> 		if (result == -1) {
> 			// ONLY happen the channel closed by remote server
> 			close();
> 			return;
> 		}
> but my version repository tell me, in the close() method, I do later
> add the buffer data check.
>
>   
I don't think I understand your proposal - the server/application needs 
to know about EOF but it looks like your ReadCompletionHandler.completed 
it not invoked when EOF is reached.

-Alan.



More information about the nio-dev mailing list