Poor performance of File Caching caused by PartOnFile
-----------------------------------------------------

                 Key: AXIS2-2516
                 URL: https://issues.apache.org/jira/browse/AXIS2-2516
             Project: Axis 2.0 (Axis2)
          Issue Type: Improvement
          Components: om
            Reporter: Liyu Yi


I noticed that the performance of "File Caching" is not great, and I believe it 
is due to the implementation of  the constructor of 
"org.apache.axiom.attachments.PartOnFile" which reads and writes the inputSteam 
byte-by-byte (see the snippets below). Can we simply apply some buffering to 
improve it?

    public PartOnFile(PushbackFilePartInputStream inStream, String repoDir) {
            ...            
            cacheFile = File.createTempFile("Axis2", ".att",
                    repoDirFile);

            FileOutputStream fileOutStream = new FileOutputStream(cacheFile);
            int value;
            value = parseTheHeaders(inStream);
            fileOutStream.write(value);
            while (!inStream.getBoundaryStatus()) {
                value = inStream.read();
                if (!inStream.getBoundaryStatus()) {
                    fileOutStream.write(value);
                }
            }

            fileOutStream.flush();
            fileOutStream.close();
        } catch (IOException e) {
            throw new OMException("Error creating temporary File.", e);
        }
    }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to