Re: svn commit: r1682057 - /lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging/MDCLoggingContext.java
These comments are so easy to miss - just happen to be scanning old email - prob best to put it in the JIRA issue. Makes sense. - Mark On Wed, May 27, 2015 at 4:01 PM Uwe Schindler u...@thetaphi.de wrote: Hi Mark, I am wondering why you be so verbose in Java 8's code. The main reason for ThreadLocal.withInitial() is to use it like that: private static final ThreadLocalInteger CALL_DEPTH = ThreadLocal.withInitial(() - 0); Using a Supplier without a lambda is not the intention behind this method /API :-) In Java 7, you can use the code like this fix comitted. If you want it verbose in Java 8, I would also use the Java 7 code... Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: markrmil...@apache.org [mailto:markrmil...@apache.org] Sent: Wednesday, May 27, 2015 5:28 PM To: comm...@lucene.apache.org Subject: svn commit: r1682057 - /lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/loggin g/MDCLoggingContext.java Author: markrmiller Date: Wed May 27 15:27:43 2015 New Revision: 1682057 URL: http://svn.apache.org/r1682057 Log: SOLR-7590: Java8 code - Java7 for branch_5x. Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/sr c/java/org/apache/solr/logging/MDCLoggingContext.java?rev=1682057r1= 1682056r2=1682057view=diff == --- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java (original) +++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/log +++ ging/MDCLoggingContext.java Wed May 27 15:27:43 2015 @@ -23,7 +23,6 @@ import static org.apache.solr.common.clo import static org.apache.solr.common.cloud.ZkStateReader.REPLICA_PROP; import static org.apache.solr.common.cloud.ZkStateReader.SHARD_ID_PROP; -import java.util.function.Supplier; import org.apache.solr.cloud.CloudDescriptor; import org.apache.solr.cloud.ZkController; @@ -39,12 +38,13 @@ import org.slf4j.MDC; */ public class MDCLoggingContext { // When a thread sets context and finds that the context is already set, we should noop and ignore the finally clear - private static ThreadLocalInteger CALL_DEPTH = ThreadLocal.withInitial(new SupplierInteger() { + private static ThreadLocalInteger CALL_DEPTH = new + ThreadLocalInteger() { @Override -public Integer get() { +protected Integer initialValue() { return 0; } - }); + }; + private static void setCollection(String collection) { if (collection != null) { - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org -- - Mark about.me/markrmiller
RE: svn commit: r1682057 - /lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging/MDCLoggingContext.java
Hi Mark, I am wondering why you be so verbose in Java 8's code. The main reason for ThreadLocal.withInitial() is to use it like that: private static final ThreadLocalInteger CALL_DEPTH = ThreadLocal.withInitial(() - 0); Using a Supplier without a lambda is not the intention behind this method /API :-) In Java 7, you can use the code like this fix comitted. If you want it verbose in Java 8, I would also use the Java 7 code... Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: markrmil...@apache.org [mailto:markrmil...@apache.org] Sent: Wednesday, May 27, 2015 5:28 PM To: comm...@lucene.apache.org Subject: svn commit: r1682057 - /lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/loggin g/MDCLoggingContext.java Author: markrmiller Date: Wed May 27 15:27:43 2015 New Revision: 1682057 URL: http://svn.apache.org/r1682057 Log: SOLR-7590: Java8 code - Java7 for branch_5x. Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/sr c/java/org/apache/solr/logging/MDCLoggingContext.java?rev=1682057r1= 1682056r2=1682057view=diff == --- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/logging /MDCLoggingContext.java (original) +++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/log +++ ging/MDCLoggingContext.java Wed May 27 15:27:43 2015 @@ -23,7 +23,6 @@ import static org.apache.solr.common.clo import static org.apache.solr.common.cloud.ZkStateReader.REPLICA_PROP; import static org.apache.solr.common.cloud.ZkStateReader.SHARD_ID_PROP; -import java.util.function.Supplier; import org.apache.solr.cloud.CloudDescriptor; import org.apache.solr.cloud.ZkController; @@ -39,12 +38,13 @@ import org.slf4j.MDC; */ public class MDCLoggingContext { // When a thread sets context and finds that the context is already set, we should noop and ignore the finally clear - private static ThreadLocalInteger CALL_DEPTH = ThreadLocal.withInitial(new SupplierInteger() { + private static ThreadLocalInteger CALL_DEPTH = new + ThreadLocalInteger() { @Override -public Integer get() { +protected Integer initialValue() { return 0; } - }); + }; + private static void setCollection(String collection) { if (collection != null) { - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org