ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject odd code in Get.java
Date Mon, 19 Mar 2001 20:06:37 GMT
While am at it, there is a bit of code in Get.java that I am debating
whether it makes sense to retain

If you look at line 148 onwards, you see that the code makes a number of
attempts to connect to the server before bailing out, eating any IO
exceptions and retrying. Then there is some followon code which recognises
that the three attempts failed, and generates a new exception (losing any IO
exception information in the process)

            for( int i=0; i< 3 ; i++ ) {
                try {
                    is = connection.getInputStream();
                    break;
                } catch( IOException ex ) {
                    log( "Error opening connection " + ex );
                }
            }
            if( is==null ) {
                log( "Can't get " + source + " to " + dest);
                if(ignoreErrors)
                    return;
                throw new BuildException( "Can't get " + source + " to " +
dest,
                                          location);
            }

I can only infer that this code is there because somehow the
connection.getInputStream() call was failing on the first couple of
attempts. I've never encountered this myself (unless the far end isnt
actually there).

Should this code be retained in a rework of Get.java?

If so, should the number of retries be configurable, and a sleep period
added between each attempt? That way if the server really is missing then we
can survive a reboot of the server or some upstream node.

Personally, I am just as happy dropping it, but people with less reliable
network connections may want it kept and configurable. If it is retained I
will save the IOException for use in constructing the BuildException.

-Steve




Mime
View raw message