driftx commented on code in PR #4624:
URL: https://github.com/apache/cassandra/pull/4624#discussion_r2823331286
##########
test/unit/org/apache/cassandra/net/MatcherResponse.java:
##########
@@ -39,6 +41,8 @@
*/
public class MatcherResponse
{
+ // destroyed by finalizer
+ private final Executor responseExecutor =
Executors.newSingleThreadExecutor();
Review Comment:
Declare this an ExecutorService instead so we get the
shutdown()/shutdownNow() methods, then we can call shutdown() in the destroy()
method.
##########
test/unit/org/apache/cassandra/hints/HintsServiceTest.java:
##########
@@ -210,7 +213,14 @@ public void testPageSeek() throws InterruptedException,
ExecutionException
// verify that we have a dispatch offset set for the page we're
currently stuck at
HintsStore store =
HintsService.instance.getCatalog().get(StorageService.instance.getLocalHostUUID());
- HintsDescriptor descriptor = store.poll();
+ AtomicReference<HintsDescriptor> hintDescriptorRef = new
AtomicReference<>();
+ Util.spinUntilTrue(() -> {
Review Comment:
Could use Awaitility here instead.
##########
test/unit/org/apache/cassandra/net/MatcherResponse.java:
##########
@@ -39,6 +41,8 @@
*/
public class MatcherResponse
{
+ // destroyed by finalizer
Review Comment:
I'm not sure about this. The Executor[Service] returned by
Executors.newSingleThreadExecutor() has no finalizer-based cleanup. Also I
think the non-daemon worker thread holds a strong reference back to the
executor, preventing the MatcherResponse from being garbage collected at all.
##########
test/unit/org/apache/cassandra/net/MatcherResponse.java:
##########
@@ -182,7 +186,7 @@ public boolean test(Message message, InetAddressAndPort to)
}
// create response asynchronously to match
request/response communication execution behavior
- new Thread(() ->
+ responseExecutor.execute(() ->
{
Message<?> response = fnResponse.apply(message, to);
Review Comment:
Since this is a single threaded Executor[Service], any fnResponse callback
that blocks it will block all subsequent responses...maybe we should consider a
small pool?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]