[jboss-cvs] JBoss Messaging SVN: r5836 - in trunk/src/main/org/jboss/messaging/core/persistence/impl: nullpm and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 6 18:54:15 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-02-06 18:54:15 -0500 (Fri, 06 Feb 2009)
New Revision: 5836

Modified:
   trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
   trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
Log:
auto-cleanup only (no code changes)

Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java	2009-02-06 20:02:51 UTC (rev 5835)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java	2009-02-06 23:54:15 UTC (rev 5836)
@@ -59,7 +59,7 @@
    private SequentialFile file;
 
    private boolean complete = false;
-   
+
    private long bodySize = -1;
 
    // Static --------------------------------------------------------
@@ -76,14 +76,16 @@
     * @param copy
     * @param fileCopy
     */
-   private JournalLargeServerMessage(final JournalLargeServerMessage copy, final SequentialFile fileCopy, final long newID)
+   private JournalLargeServerMessage(final JournalLargeServerMessage copy,
+                                     final SequentialFile fileCopy,
+                                     final long newID)
    {
       super(copy);
-      this.storageManager = copy.storageManager;
-      this.file = fileCopy;
-      this.complete = true;
-      this.bodySize = copy.bodySize;
-      this.setMessageID(newID);
+      storageManager = copy.storageManager;
+      file = fileCopy;
+      complete = true;
+      bodySize = copy.bodySize;
+      setMessageID(newID);
    }
 
    // Public --------------------------------------------------------
@@ -103,7 +105,7 @@
       file.position(file.size());
 
       file.write(ByteBuffer.wrap(bytes), false);
-      
+
       bodySize += bytes.length;
    }
 
@@ -177,9 +179,9 @@
 
    @Override
    public int decrementRefCount()
-   {      
+   {
       int currentRefCount = super.decrementRefCount();
-      
+
       if (currentRefCount == 0)
       {
          if (isTrace)
@@ -200,6 +202,7 @@
       return currentRefCount;
    }
 
+   @Override
    public boolean isLargeMessage()
    {
       return true;
@@ -212,8 +215,8 @@
          storageManager.deleteFile(file);
       }
    }
-   
-   //We cache this
+
+   // We cache this
    private volatile int memoryEstimate = -1;
 
    @Override
@@ -224,7 +227,7 @@
          // The body won't be on memory (aways on-file), so we don't consider this for paging
          memoryEstimate = getPropertiesEncodeSize() + SIZE_INT + getEncodeSize() + (16 + 4) * 2 + 1;
       }
-      
+
       return memoryEstimate;
    }
 
@@ -253,48 +256,48 @@
          }
       }
    }
-   
+
    // TODO: Optimize this per https://jira.jboss.org/jira/browse/JBMESSAGING-1468
+   @Override
    public synchronized ServerMessage copy(final long newID) throws Exception
    {
       SequentialFile newfile = storageManager.createFileForLargeMessage(newID, complete);
-      
+
       file.open();
       newfile.open();
-      
+
       file.position(0);
       newfile.position(0);
-      
+
       ByteBuffer buffer = ByteBuffer.allocate(100 * 1024);
-      
-      for (long i = 0;i<file.size();)
+
+      for (long i = 0; i < file.size();)
       {
          buffer.rewind();
          file.read(buffer);
          newfile.write(buffer, false);
-         i+=buffer.limit();
+         i += buffer.limit();
       }
-      
-      
+
       file.close();
       newfile.close();
-      
+
       JournalLargeServerMessage newMessage = new JournalLargeServerMessage(this, newfile, newID);
-      
+
       return newMessage;
    }
-      
 
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
 
+   @Override
    protected void finalize() throws Throwable
    {
       releaseResources();
       super.finalize();
    }
-   
+
    // Private -------------------------------------------------------
 
    private synchronized void validateFile() throws Exception
@@ -307,9 +310,9 @@
          }
 
          file = storageManager.createFileForLargeMessage(getMessageID(), complete);
-         
+
          file.open();
-         
+
          bodySize = file.size();
 
       }

Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java	2009-02-06 20:02:51 UTC (rev 5835)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java	2009-02-06 23:54:15 UTC (rev 5836)
@@ -68,21 +68,21 @@
     */
    public synchronized void addBytes(final byte[] bytes)
    {
-      MessagingBuffer buffer = this.getBody();
-      
+      MessagingBuffer buffer = getBody();
+
       if (buffer != null)
       {
          ByteBuffer newBuffer = ByteBuffer.allocate(buffer.limit() + bytes.length);
          newBuffer.put(buffer.array());
          buffer = new ByteBufferWrapper(newBuffer);
-         this.setBody(buffer);
+         setBody(buffer);
       }
       else
       {
          buffer = new ByteBufferWrapper(ByteBuffer.allocate(bytes.length));
-         this.setBody(buffer);
+         setBody(buffer);
       }
-      
+
       buffer.putBytes(bytes);
    }
 
@@ -100,9 +100,10 @@
    public void complete() throws Exception
    {
       // nothing to be done here.. we don really have a file on this Storage
-      
+
    }
 
+   @Override
    public boolean isLargeMessage()
    {
       return true;




More information about the jboss-cvs-commits mailing list