dev@grizzly.java.net

Re: OutputWrite write()>=0

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 24 Jul 2007 10:53:13 +0200

Hi,

ÏòÇØÏÍ wrote:
> Hi Jeanfrancois£¬
> Do you remember my comments on your blog on grizzly tricks and tips:)

Yes :-) Can you file a bug and attach your patch? The patch looks good
and I will go ahead and apply it once I've a chance.

Thanks!!

-- Jeanfrancois

> I checked out write operation again and give a patch.
> maybe you can check it.
>
> Index:
> F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java
>
> ===================================================================
> ---
> F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java
> (revision 394)
> +++
> F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java
> (working copy)
> @@ -86,14 +86,13 @@
> try {
> while ( bb.hasRemaining() ) {
> int len = socketChannel.write(bb);
> - attempts++;
> - if (len < 0){
> - throw new EOFException();
> - }
> -
> - bytesProduced += len;
> -
> - if (len == 0) {
> + if (len>0){
> + attempts = 0;
> + bytesProduced += len;
> + }else {
> + //handle write count = 0;NOTE write() return result
> >=0, no <0 exist.
> + attempts++;
> +
> if ( writeSelector == null ){
> writeSelector = SelectorFactory.getSelector();
> if ( writeSelector == null){
> @@ -111,8 +110,7 @@
> } else {
> attempts--;
> }
> - } else {
> - attempts = 0;
> + //handle write count = 0 end;
> }
> }
> } finally {
>
>
> --
> Ö¾´
> ÏòÇØÏÍ
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net