You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/09/27 00:48:52 UTC
[geode] branch feature/GEODE-3273 updated: GEODE-3273: only to
catch exception of toDocuments()
This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a commit to branch feature/GEODE-3273
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-3273 by this push:
new 58cf3e8 GEODE-3273: only to catch exception of toDocuments()
58cf3e8 is described below
commit 58cf3e8c5d08133bae22cd3ee07145fa72a1a976
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Tue Sep 26 17:48:19 2017 -0700
GEODE-3273: only to catch exception of toDocuments()
---
.../internal/repository/IndexRepositoryImpl.java | 23 ++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
index 3eb6ba5..4a856a0 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -35,6 +35,7 @@ import org.apache.geode.distributed.LockNotHeldException;
import java.io.IOException;
import java.util.Collection;
+import java.util.Collections;
import java.util.function.IntSupplier;
/**
@@ -78,13 +79,16 @@ public class IndexRepositoryImpl implements IndexRepository {
@Override
public void create(Object key, Object value) throws IOException {
long start = stats.startUpdate();
+ Collection<Document> docs = Collections.emptyList();
try {
- Collection<Document> docs = serializer.toDocuments(index, value);
+ try {
+ docs = serializer.toDocuments(index, value);
+ } catch (Exception e) {
+ stats.incFailedEntries();
+ logger.info("Failed to add index for " + value + " due to " + e.getMessage());
+ }
docs.forEach(doc -> SerializerUtil.addKey(key, doc));
writer.addDocuments(docs);
- } catch (Exception e) {
- stats.incFailedEntries();
- logger.info("Failed to add index for " + value + " due to " + e.getMessage());
} finally {
stats.endUpdate(start);
}
@@ -93,14 +97,17 @@ public class IndexRepositoryImpl implements IndexRepository {
@Override
public void update(Object key, Object value) throws IOException {
long start = stats.startUpdate();
+ Collection<Document> docs = Collections.emptyList();
try {
- Collection<Document> docs = serializer.toDocuments(index, value);
+ try {
+ docs = serializer.toDocuments(index, value);
+ } catch (Exception e) {
+ stats.incFailedEntries();
+ logger.info("Failed to update index for " + value + " due to " + e.getMessage());
+ }
docs.forEach(doc -> SerializerUtil.addKey(key, doc));
Term keyTerm = SerializerUtil.toKeyTerm(key);
writer.updateDocuments(keyTerm, docs);
- } catch (Exception e) {
- stats.incFailedEntries();
- logger.info("Failed to update index for " + value + " due to " + e.getMessage());
} finally {
stats.endUpdate(start);
}
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].