4 Replies Latest reply on Oct 26, 2009 12:06 PM by clebert.suconic

    JournalLargeServerMessage copy

    timfox

       

      SequentialFile newfile = storageManager.createFileForLargeMessage(idToUse, isStored());
      
       file.open();
      
       ServerMessage newMessage = new JournalLargeServerMessage(linkMessage == null ? this
       : (JournalLargeServerMessage)linkMessage,
       newfile,
       newID);
      


      So, it's creating a new file every time a large message is copied? (E.g. sent to expiry queue).

      I thought the point was to avoid such copying?

        • 1. Re: JournalLargeServerMessage copy
          timfox

          Also... it's opening a new file for each large message that is copied?

          Surely, you'll run out of file handles doing this?

          • 2. Re: JournalLargeServerMessage copy
            timfox

            Another thing I don't understand about this - why is it incrementing the ref count?

            • 3. Re: JournalLargeServerMessage copy
              clebert.suconic

              That's using the same file name, but a different File Handler thourgh SequentialFile.


              The increment is to avoid deleting the linkedMessage. So, the copied Message will be holding a reference until the message is also dereferenced. (on that case the original file will be deleted later).

              Look at JournalLargeServerMessage::decrementReference:

              if (linkMessage != null)
               {
               // This file is linked to another message, deleting the reference where it belongs on this case
               linkMessage.decrementRefCount();
               }
              


              • 4. Re: JournalLargeServerMessage copy
                clebert.suconic

                 

                "timfox" wrote:
                Also... it's opening a new file for each large message that is copied?

                Surely, you'll run out of file handles doing this?



                That was an accident. I'm removing the file.open();