You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directmemory.apache.org by si...@apache.org on 2012/02/16 21:02:23 UTC

svn commit: r1245147 - /incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java

Author: simonetripodi
Date: Thu Feb 16 20:02:23 2012
New Revision: 1245147

URL: http://svn.apache.org/viewvc?rev=1245147&view=rev
Log:
code format

Modified:
    incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java

Modified: incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java?rev=1245147&r1=1245146&r2=1245147&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java (original)
+++ incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java Thu Feb 16 20:02:23 2012
@@ -21,9 +21,8 @@ package org.apache.directmemory.memory;
 
 /**
  * PoC of {@link MemoryManagerService} that allows {@link AllocationPolicy} to get wired.
- * 
- * @author bperroud
  *
+ * @author bperroud
  */
 public class MemoryManagerServiceWithAllocationPolicyImpl
     extends MemoryManagerServiceImpl
@@ -37,31 +36,35 @@ public class MemoryManagerServiceWithAll
         super.init( numberOfBuffers, size );
         allocationPolicy.init( getBuffers() );
     }
-    
+
     public void setAllocationPolicy( final AllocationPolicy allocationPolicy )
     {
         this.allocationPolicy = allocationPolicy;
     }
 
     @Override
-    public OffHeapMemoryBuffer getActiveBuffer() {
+    public OffHeapMemoryBuffer getActiveBuffer()
+    {
         return allocationPolicy.getActiveBuffer( null, 0 );
     }
-    
+
     @Override
     public Pointer store( byte[] payload, int expiresIn )
     {
         Pointer p = null;
         OffHeapMemoryBuffer buffer = null;
         int allocationNumber = 1;
-        do {
+        do
+        {
             buffer = allocationPolicy.getActiveBuffer( buffer, allocationNumber );
-            if (buffer == null) {
+            if ( buffer == null )
+            {
                 return null;
             }
             p = buffer.store( payload, expiresIn );
             allocationNumber++;
-        } while (p == null);
+        }
+        while ( p == null );
         return p;
     }
 
@@ -72,22 +75,24 @@ public class MemoryManagerServiceWithAll
         allocationPolicy.reset();
     }
 
-    
     @Override
     public Pointer allocate( int size, long expiresIn, long expires )
     {
         Pointer p = null;
         OffHeapMemoryBuffer buffer = null;
         int allocationNumber = 1;
-        do {
+        do
+        {
             buffer = allocationPolicy.getActiveBuffer( buffer, allocationNumber );
-            if (buffer == null) {
+            if ( buffer == null )
+            {
                 return null;
             }
             p = buffer.allocate( size, expiresIn, expires );
             allocationNumber++;
-        } while (p == null);
+        }
+        while ( p == null );
         return p;
     }
-    
+
 }