directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r638516 - /directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java
Date Tue, 18 Mar 2008 19:22:05 GMT
Author: kayyagari
Date: Tue Mar 18 12:22:00 2008
New Revision: 638516

URL: http://svn.apache.org/viewvc?rev=638516&view=rev
Log:
moved the LinkedAvlNodes array (nodes) from global scope to method local scope to make it
thread safe

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java?rev=638516&r1=638515&r2=638516&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMarshaller.java
Tue Mar 18 12:22:00 2008
@@ -46,8 +46,6 @@
     /** key Comparator for the AvlTree */
     private Comparator<E> comparator;
     
-    private LinkedAvlNode[] nodes;
-    
 
     /**
      * Creates a new instance of AvlTreeMarshaller with a custom key
@@ -190,8 +188,8 @@
             
             int size = din.readInt();
             
-            nodes = new LinkedAvlNode[ size ];
-            LinkedAvlNode<E> root = readTree( din, null );
+            LinkedAvlNode[] nodes = new LinkedAvlNode[ size ];
+            LinkedAvlNode<E> root = readTree( din, null, nodes );
             
             AvlTree<E> tree = new AvlTree<E>( comparator );
             
@@ -231,7 +229,7 @@
      * @return the deserialized AvlTree node
      * @throws IOException on failures to deserialize or read from the stream
      */
-    public LinkedAvlNode<E> readTree( DataInputStream in, LinkedAvlNode<E> node
) throws IOException
+    public LinkedAvlNode<E> readTree( DataInputStream in, LinkedAvlNode<E> node,
LinkedAvlNode[] nodes ) throws IOException
     {
         int dLen = in.readInt();
       
@@ -250,14 +248,14 @@
       
         if( childMarker == 2)
         {
-            node.setLeft( readTree( in, node.getLeft() ) );
+            node.setLeft( readTree( in, node.getLeft(), nodes ) );
         }
       
         childMarker = in.readInt();
       
         if( childMarker == 4 )
         {
-            node.setRight( readTree( in, node.getRight() ) );
+            node.setRight( readTree( in, node.getRight(), nodes ) );
         }
       
         return node;



Mime
View raw message