You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/04/01 04:54:14 UTC
[GitHub] [accumulo] ctubbsii commented on a change in pull request #2590: Change location where Thread.start() is called to resolve ErrorProne warning
ctubbsii commented on a change in pull request #2590:
URL: https://github.com/apache/accumulo/pull/2590#discussion_r835559945
##########
File path: core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
##########
@@ -836,7 +834,7 @@ public synchronized void setIdleTime(long time) {
}
void startCheckerThread() {
- checkThreadFactory.get();
+ checkThreadFactory.get().start();
Review comment:
This changes behavior. This start method is now called whenever this method is called, instead of it only being called once when it is memoized. I think that was the point of memoizing this, to force it to be a singleton, and to prevent it from being started multiple times. If start is called here, and this method is only called once, I'm not sure there's any point in having it memoized anymore.
##########
File path: core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
##########
@@ -365,9 +365,7 @@ void returnConnectionToUnreserved(final CachedConnections connections,
private final Set<ThriftTransportKey> serversWarnedAbout = new HashSet<>();
private final Supplier<Thread> checkThreadFactory = Suppliers.memoize(() -> {
- var thread = Threads.createThread("Thrift Connection Pool Checker", new Closer());
- thread.start();
- return thread;
+ return Threads.createThread("Thrift Connection Pool Checker", new Closer());
Review comment:
When collapsing a lambda down to one statement, it is often no longer necessary to have the curly braces, return statement and final semi-colon, except for formatting/readability. This one would have wrapped either way, but it would only be 2 lines instead of 3 if the curly braces were removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org