Author: olamy
Date: Wed Jun 13 21:10:15 2012
New Revision: 1350017

URL: http://svn.apache.org/viewvc?rev=1350017&view=rev
Log:
code format no other changes

Modified:
    
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/DirectMemory.java
    
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/allocator/FixedSizeByteBufferAllocatorImpl.java

Modified: 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/DirectMemory.java
URL: 
http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/DirectMemory.java?rev=1350017&r1=1350016&r2=1350017&view=diff
==============================================================================
--- 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/DirectMemory.java
 (original)
+++ 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/DirectMemory.java
 Wed Jun 13 21:10:15 2012
@@ -51,7 +51,7 @@ public final class DirectMemory<K, V>
 
     private int numberOfBuffers;
 
-    private int size;
+    private int sizes;
 
     private int initialCapacity = DEFAULT_INITIAL_CAPACITY;
 

Modified: 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/allocator/FixedSizeByteBufferAllocatorImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/allocator/FixedSizeByteBufferAllocatorImpl.java?rev=1350017&r1=1350016&r2=1350017&view=diff
==============================================================================
--- 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/allocator/FixedSizeByteBufferAllocatorImpl.java
 (original)
+++ 
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/allocator/FixedSizeByteBufferAllocatorImpl.java
 Wed Jun 13 21:10:15 2012
@@ -33,9 +33,8 @@ import static com.google.common.base.Pre
 
 /**
  * {@link ByteBufferAllocator} implementation that instantiate {@link 
ByteBuffer}s of fixed size, called slices.
- * 
+ *
  * @since 0.6
- * 
  */
 public class FixedSizeByteBufferAllocatorImpl
     extends AbstractByteBufferAllocator
@@ -55,30 +54,32 @@ public class FixedSizeByteBufferAllocato
 
     // Tells if it returns null or throw an BufferOverflowException when the 
requested size is bigger than the size of the slices
     private boolean returnNullWhenOversizingSliceSize = true;
-    
+
     // Tells if it returns null when no buffers are available
     private boolean returnNullWhenNoBufferAvailable = true;
 
     // Collection that keeps track of borrowed buffers
     private final Map<Integer, ByteBuffer> usedSliceBuffers = new 
ConcurrentHashMap<Integer, ByteBuffer>();
 
-    
+
     /**
      * Constructor.
-     * @param number : internal identifier of the allocator
-     * @param totalSize : the internal buffer
-     * @param sliceSize : arbitrary number of the buffer.
+     *
+     * @param number           : internal identifier of the allocator
+     * @param totalSize        : the internal buffer
+     * @param sliceSize        : arbitrary number of the buffer.
      * @param numberOfSegments : number of parent {@link ByteBuffer} to 
allocate.
      */
-    public FixedSizeByteBufferAllocatorImpl( final int number, final int 
totalSize, final int sliceSize, final int numberOfSegments )
+    public FixedSizeByteBufferAllocatorImpl( final int number, final int 
totalSize, final int sliceSize,
+                                             final int numberOfSegments )
     {
         super( number );
-        
+
         this.totalSize = totalSize;
         this.sliceSize = sliceSize;
 
-        this.segmentsBuffers = new ArrayList<ByteBuffer>(numberOfSegments);
-        
+        this.segmentsBuffers = new ArrayList<ByteBuffer>( numberOfSegments );
+
         init( numberOfSegments );
 
     }
@@ -86,7 +87,7 @@ public class FixedSizeByteBufferAllocato
     protected void init( final int numberOfSegments )
     {
         checkArgument( numberOfSegments > 0 );
-        
+
         // Compute the size of each segments
         int segmentSize = totalSize / numberOfSegments;
         // size is rounded down to a multiple of the slice size
@@ -107,14 +108,14 @@ public class FixedSizeByteBufferAllocato
             }
         }
     }
-    
+
 
     protected ByteBuffer findFreeBuffer( int capacity )
     {
         // ensure the requested size is not bigger than the slices' size
         if ( capacity > sliceSize )
         {
-            if (returnNullWhenOversizingSliceSize)
+            if ( returnNullWhenOversizingSliceSize )
             {
                 return null;
             }
@@ -132,7 +133,7 @@ public class FixedSizeByteBufferAllocato
     {
 
         checkState( !isClosed() );
-        
+
         if ( usedSliceBuffers.remove( getHash( byteBuffer ) ) == null )
         {
             return;
@@ -150,12 +151,12 @@ public class FixedSizeByteBufferAllocato
     {
 
         checkState( !isClosed() );
-        
+
         ByteBuffer allocatedByteBuffer = findFreeBuffer( size );
 
         if ( allocatedByteBuffer == null )
         {
-            if (returnNullWhenNoBufferAvailable)
+            if ( returnNullWhenNoBufferAvailable )
             {
                 return null;
             }
@@ -195,23 +196,23 @@ public class FixedSizeByteBufferAllocato
     {
         return totalSize;
     }
-    
+
     @Override
     public void close()
     {
         checkState( !isClosed() );
-        
+
         setClosed( true );
-        
+
         clear();
-        
+
         for ( final ByteBuffer buffer : segmentsBuffers )
         {
-            try 
+            try
             {
                 DirectByteBufferUtils.destroyDirectByteBuffer( buffer );
             }
-            catch (Exception e)
+            catch ( Exception e )
             {
                 getLogger().warn( "Exception thrown while closing the 
allocator", e );
             }


Reply via email to