Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-2516

Poor performance of File Caching caused by PartOnFile

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • None
    • None
    • om
    • None

    Description

      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); }

      }

      Attachments

        Activity

          People

            thilina Nanayakkara Kuruppuge Thilina Gunarathne
            lyi Liyu Yi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: