You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by el...@apache.org on 2013/07/19 18:22:44 UTC
svn commit: r1504930 -
/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java
Author: elecharny
Date: Fri Jul 19 16:22:44 2013
New Revision: 1504930
URL: http://svn.apache.org/r1504930
Log:
Minor formatting
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java?rev=1504930&r1=1504929&r2=1504930&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/DuplicateKeyMemoryHolder.java Fri Jul 19 16:22:44 2013
@@ -40,15 +40,16 @@ public class DuplicateKeyMemoryHolder<K,
/** The BTree */
private BTree<K, V> btree;
- /* the name of the value container btree. This value is set only when the parent BTree is in managed mode */
+ /** the name of the value container btree. This value is set only when the parent BTree is in managed mode */
private String name;
-
- /* The reference to the Value instance, or null if it's not present. This will be null when the parent BTree is in managed mode */
+
+ /** The reference to the Value instance, or null if it's not present. This will be null when the parent BTree is in managed mode */
private BTree<V, V> valueContainer;
- /* This value is set only when the parent BTree is in managed mode */
+ /** This value is set only when the parent BTree is in managed mode */
private SoftReference<BTree<V, V>> reference;
+
/**
* Create a new holder storing an offset and a SoftReference containing the value.
*
@@ -63,29 +64,28 @@ public class DuplicateKeyMemoryHolder<K,
{
BTree<V, V> valueContainer = new BTree<V, V>( UUID.randomUUID().toString(), btree.getValueSerializer(),
btree.getValueSerializer() );
-
-
- if( btree.isManaged() )
+
+ if ( btree.isManaged() )
{
- this.name = valueContainer.getName();
-
+ name = valueContainer.getName();
+
try
{
btree.getRecordManager().manage( valueContainer, true );
}
- catch( BTreeAlreadyManagedException e )
+ catch ( BTreeAlreadyManagedException e )
{
// should never happen
throw new RuntimeException( e );
}
-
- reference = new SoftReference<BTree<V,V>>( valueContainer );
+
+ reference = new SoftReference<BTree<V, V>>( valueContainer );
}
else
{
this.valueContainer = valueContainer;
}
-
+
valueContainer.insert( value, null, 0 );
}
catch ( IOException e )
@@ -94,15 +94,15 @@ public class DuplicateKeyMemoryHolder<K,
}
}
-
- /* No qualifier */ DuplicateKeyMemoryHolder( BTree<K, V> btree, BTree<V,V> valueContainer )
+
+ /* No qualifier */DuplicateKeyMemoryHolder( BTree<K, V> btree, BTree<V, V> valueContainer )
{
this.btree = btree;
-
- if( btree.isManaged() )
+
+ if ( btree.isManaged() )
{
- this.name = valueContainer.getName();
- reference = new SoftReference<BTree<V,V>>( valueContainer );
+ name = valueContainer.getName();
+ reference = new SoftReference<BTree<V, V>>( valueContainer );
}
else
{
@@ -110,27 +110,27 @@ public class DuplicateKeyMemoryHolder<K,
}
}
-
+
/**
* {@inheritDoc}
*/
@Override
public V getValue( BTree<K, V> btree )
{
- if( !btree.isManaged() )
+ if ( !btree.isManaged() )
{
return ( V ) valueContainer;
}
-
+
// wrong cast to please compiler
- BTree<V,V> valueContainer = reference.get();
-
- if( valueContainer == null )
+ BTree<V, V> valueContainer = reference.get();
+
+ if ( valueContainer == null )
{
valueContainer = btree.getRecordManager().getManagedTree( name );
- reference = new SoftReference<BTree<V,V>>( valueContainer );
+ reference = new SoftReference<BTree<V, V>>( valueContainer );
}
-
+
return ( V ) valueContainer;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org