kirklund commented on a change in pull request #7449:
URL: https://github.com/apache/geode/pull/7449#discussion_r838797922



##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java
##########
@@ -141,7 +141,6 @@ public void beforeProcessMessage(final 
ClusterDistributionManager dm,
                         } catch (TimeoutException | InterruptedException e) {
                           fail("message observus interruptus");

Review comment:
       This is existing code, so just a quick comment here. This fail is 
invoked in a background thread which JUnit can't catch, so it'll typically fail 
during the grep for suspect strings but only if the product catches the 
`AssertionError` typically in a `catch Throwable` block with logging of the 
stack trace.
   
   The better way to do this is use `DistributedErrorCollector` in a dunit test 
like this or `ErrorCollector` in all other types of tests:
   ```
   @Rule
   public DistributedErrorCollector errorCollector = new 
DistributedErrorCollector();
   ```
   ```
   } catch (TimeoutException | InterruptedException e) {
     errorCollector.addError(e);
   ```
   `DistributedErrorCollector` is useable from any thread in any DUnit VM. 
Basically each VM has its own `ErrorCollector` and then the tearDown of the 
Rule combines the errors collected within all of the VMs.

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
##########
@@ -2527,7 +2527,7 @@ private void writeAsync(SocketChannel channel, ByteBuffer 
buffer, boolean forceA
         long queueTimeoutTarget = now + asyncQueueTimeout;
         channel.configureBlocking(false);
         try {
-          try (final ByteBufferSharing outputSharing = ioFilter.wrap(buffer)) {
+          try (final ByteBufferSharing outputSharing = ioFilter.wrap(buffer, 
channel)) {

Review comment:
       I recommend extracting some methods throughout the code you're touching 
to minimize nested try-blocks, if-blocks and loops. It really helps clean it up 
and improve readability.




-- 
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]


Reply via email to