pivotal-jbarrett commented on PR #7721:
URL: https://github.com/apache/geode/pull/7721#issuecomment-1151458738

   @DonalEvans what if we refactored a little to a method that takes function 
to execute and optionally ignores this specific exception, then we could at 
least deterministically test that part of the behavior and change in this PR. 🤷 
   ```java
   private void doAndIgnoreRejectedExecutionExceptionIfStopping(final 
SomeFunctionalnterface someFunctionalThing) {
     try {
       someFunctionalThing.doIt();
     } catch (RejectedExecutionException e) {
       if (!isStopping) {
         throw e;
       }
     }
   }
   
   ...
         doAndIgnoreRejectedExecutionExceptionIfStopping(() ->
           checkExecutor.execute(() -> {
              try {
                inlineCheckIfAvailable(initiator, cv, true, mbr, reason);
              } catch (MembershipClosedException e) {
                // shutting down
              } catch (Exception e) {
                logger.info("Unexpected exception while verifying member", e);
              }
            }));
   ...
   ```
   
   
   
   ```java
   @Test
   void doAndIgnoreRejectedExecutionExceptionIfStoppingThrowsWhenNotStopping() {
     gmsHealthMonitor.isStopping = true;
     assertThatThrowBy(() -> 
gmsHealthMonitor.doAndIgnoreRejectedExecutionExceptionIfStopping(() -> {throw 
new 
RejectedExecutionException();})).isInstanceOf(RejectedExecutionException.class);
   }
   ```
   
   


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