lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:branch_6x: SOLR-8995: Use lambda in PeerSync ObjectResolver
Date Thu, 18 Aug 2016 05:12:52 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 10e7efa91 -> 29494f3cc


SOLR-8995: Use lambda in PeerSync ObjectResolver


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/29494f3c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/29494f3c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/29494f3c

Branch: refs/heads/branch_6x
Commit: 29494f3cce3376c5c024963cfae61e468f3d22ce
Parents: 10e7efa
Author: Noble Paul <noble@apache.org>
Authored: Thu Aug 18 10:37:09 2016 +0530
Committer: Noble Paul <noble@apache.org>
Committed: Thu Aug 18 10:42:12 2016 +0530

----------------------------------------------------------------------
 .../org/apache/solr/update/TransactionLog.java   | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/29494f3c/solr/core/src/java/org/apache/solr/update/TransactionLog.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
index 673d683..860717f 100644
--- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
+++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
@@ -87,18 +87,15 @@ public class TransactionLog implements Closeable {
   int snapshot_numRecords;
 
   // write a BytesRef as a byte array
-  JavaBinCodec.ObjectResolver resolver = new JavaBinCodec.ObjectResolver() {
-    @Override
-    public Object resolve(Object o, JavaBinCodec codec) throws IOException {
-      if (o instanceof BytesRef) {
-        BytesRef br = (BytesRef)o;
-        codec.writeByteArray(br.bytes, br.offset, br.length);
-        return null;
-      }
-      // Fallback: we have no idea how to serialize this.  Be noisy to prevent insidious
bugs
-      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
-          "TransactionLog doesn't know how to serialize " + o.getClass() + "; try implementing
ObjectResolver?");
+  JavaBinCodec.ObjectResolver resolver = (o, codec) -> {
+    if (o instanceof BytesRef) {
+      BytesRef br = (BytesRef)o;
+      codec.writeByteArray(br.bytes, br.offset, br.length);
+      return null;
     }
+    // Fallback: we have no idea how to serialize this.  Be noisy to prevent insidious bugs
+    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+        "TransactionLog doesn't know how to serialize " + o.getClass() + "; try implementing
ObjectResolver?");
   };
 
   public class LogCodec extends JavaBinCodec {


Mime
View raw message