ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r947339 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/util/ResourceUtils.java
Date Sat, 22 May 2010 22:00:52 GMT
Author: jkf
Date: Sat May 22 22:00:52 2010
New Revision: 947339

URL: http://svn.apache.org/viewvc?rev=947339&view=rev
Log:
pr 49326. Sun JVM tries to mmap the entire file during a copy. For large files this is not
feasible. We now explicitly request to copy at most 16 MiB per request.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=947339&r1=947338&r2=947339&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat May 22 22:00:52 2010
@@ -17,6 +17,11 @@ Changes that could break older environme
 Fixed bugs:
 -----------
 
+ * The Sun JVM tries to mmap the entire file during a copy. 
+   For large files this is not feasible. 
+   We now explicitly request to copy at most 16 MiB per request.
+   Bugzilla Report 49326.
+   
  * DemuxInputStream.read() should return unsigned values
    Bugzilla Report 49279.
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java?rev=947339&r1=947338&r2=947339&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java Sat May 22 22:00:52
2010
@@ -72,6 +72,8 @@ public class ResourceUtils {
      */
     public static final String ISO_8859_1 = "ISO-8859-1";
 
+    private static final long MAX_IO_CHUNCK_SIZE = 16*1024*1024; // 16 MB
+
     /**
      * Tells which source files should be reprocessed based on the
      * last modification date of target files.
@@ -526,8 +528,9 @@ public class ResourceUtils {
                 long position = 0;
                 long count = srcChannel.size();
                 while (position < count) {
+                    long chunck = Math.min(MAX_IO_CHUNCK_SIZE, count - position);
                     position +=
-                        srcChannel.transferTo(position, count - position,
+                        srcChannel.transferTo(position, chunck,
                                               destChannel);
                 }
             } finally {



Mime
View raw message