lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1041914 - in /lucene/dev/trunk/lucene: contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp src/test/org/apache/lucene/search/TestSearchWithThreads.java
Date Fri, 03 Dec 2010 17:09:50 GMT
Author: rmuir
Date: Fri Dec  3 17:09:49 2010
New Revision: 1041914

URL: http://svn.apache.org/viewvc?rev=1041914&view=rev
Log:
LUCENE-2791: cleanup for no-copy case, remove VERBOSE prints in tests

Modified:
    lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java

Modified: lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp?rev=1041914&r1=1041913&r2=1041914&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
(original)
+++ lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
Fri Dec  3 17:09:49 2010
@@ -65,14 +65,13 @@ JNIEXPORT jlong JNICALL Java_org_apache_
 {
   char *fname;
   HANDLE handle;
-  jboolean isCopy;
   
   if (filename == NULL) {
     throwException(env, "java/lang/NullPointerException", "filename cannot be null");
     return -1;
   }
   
-  fname = (char *) env->GetStringUTFChars(filename, &isCopy);
+  fname = (char *) env->GetStringUTFChars(filename, NULL);
   
   if (fname == NULL) {
     throwException(env, "java/lang/IllegalArgumentException", "invalid filename");
@@ -82,9 +81,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
   handle = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 
                       NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL);
   
-  if (isCopy) {
-    env->ReleaseStringUTFChars(filename, fname);
-  }
+  env->ReleaseStringUTFChars(filename, fname);
   
   if (handle == INVALID_HANDLE_VALUE) {
     throwIOException(env, GetLastError());
@@ -127,17 +124,14 @@ JNIEXPORT jint JNICALL Java_org_apache_l
     }
   	
   } else {
-    jboolean isCopy;
-    jbyte *buffer = env->GetByteArrayElements (bytes, &isCopy);
+    jbyte *buffer = env->GetByteArrayElements (bytes, NULL);
   
     if (!ReadFile((HANDLE) fd, (void *)(buffer+offset), length, &numRead, &io)) {
       throwIOException(env, GetLastError());
       numRead = -1;
     }
   	
-    if (isCopy == JNI_TRUE) {
-      env->ReleaseByteArrayElements(bytes, buffer, numRead == 0 || numRead == -1 ? JNI_ABORT
: 0);
-    }
+    env->ReleaseByteArrayElements(bytes, buffer, numRead == 0 || numRead == -1 ? JNI_ABORT
: 0);
   }
   
   return numRead;

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java?rev=1041914&r1=1041913&r2=1041914&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java Fri
Dec  3 17:09:49 2010
@@ -61,7 +61,7 @@ public class TestSearchWithThreads exten
     w.close();
 
     final long endTime = System.currentTimeMillis();
-    System.out.println("BUILD took " + (endTime-startTime));
+    if (VERBOSE) System.out.println("BUILD took " + (endTime-startTime));
 
     final IndexSearcher s = new IndexSearcher(r);
 
@@ -100,7 +100,7 @@ public class TestSearchWithThreads exten
     for(int threadID=0;threadID<NUM_SEARCH_THREADS;threadID++) {
       threads[threadID].join();
     }
-    System.out.println(NUM_SEARCH_THREADS + " threads did " + netSearch.get() + " searches");
+    if (VERBOSE) System.out.println(NUM_SEARCH_THREADS + " threads did " + netSearch.get()
+ " searches");
 
     s.close();
     r.close();



Mime
View raw message