Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

remove synchronization in Document: LUCENE-959

Yonik Seeley230ecaa169c0
diff --git a/CHANGES.txt b/CHANGES.txt
index d0ca1b89a32..2a53ce9f150 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,4 @@
-Lucene Change Log
+¿Lucene Change Log
$Id$
@@ -56,6 +56,8 @@ Optimizations
3. LUCENE-892: Fixed extra "buffer to buffer copy" that sometimes
takes place when using compound files. (Mike McCandless)
+ 4. LUCENE-959: Remove synchronization in Document (yonik)
+
Documentation
Build
diff --git a/src/java/org/apache/lucene/document/Document.java b/src/java/org/apache/lucene/document/Document.java
index 5597f5a62d6..b6deb4a9973 100644
--- a/src/java/org/apache/lucene/document/Document.java
+++ b/src/java/org/apache/lucene/document/Document.java
@@ -38,7 +38,7 @@ import java.util.*; // for javadoc
*/
public final class Document implements java.io.Serializable {
- List fields = new Vector();
+ List fields = new ArrayList();
private float boost = 1.0f;
/** Constructs a new document with no fields. */
@@ -173,7 +173,15 @@ public final class Document implements java.io.Serializable {
* @deprecated use {@link #getFields()} instead
*/
public final Enumeration fields() {
- return ((Vector)fields).elements();
+ return new Enumeration() {
+ final Iterator iter = fields.iterator();
+ public boolean hasMoreElements() {
+ return iter.hasNext();
+ }
+ public Object nextElement() {
+ return iter.next();
+ }
+ };
}
/** Returns a List of all the fields in a document.