simonbence commented on code in PR #8152:
URL: https://github.com/apache/nifi/pull/8152#discussion_r1424874235


##########
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/retry/NoReturnCallable.java:
##########
@@ -14,25 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.nifi.controller.status.history.storage;
-
-import org.apache.nifi.controller.status.history.GarbageCollectionHistory;
-import org.apache.nifi.controller.status.history.GarbageCollectionStatus;
-
-import java.time.Instant;
+package org.apache.nifi.retry;
 
 /**
- * Readable status storage for garbage collection status entries.
+ * Represents a portion of callable code without expected return value.
  */
-public interface GarbageCollectionStatusStorage extends 
StatusStorage<GarbageCollectionStatus> {
+@FunctionalInterface
+public interface NoReturnCallable {

Review Comment:
   I think, from Java Gerenics standpoint, `Void` could work out. Where it 
fails however is the way of intended usage. The `RetryTemplate` is primarily 
designed to be called not with explicit implementations of `Callable` or 
`NoReturnCallable` for that sake, but to give lambda expressions as arguments, 
like the following (from `SynchronousRetryTemplateTest`):
   
   `testSubject.execute(() -> action.getValue("okay"), FALLBACK_ACTION);`
   
   Creating an expression with `Void` return value to fit this intended use 
look to be cumbersome. So by adding `NoReturnCallable` as a functional 
interface, which internally wraps these "void return" or "no return" lambdas  
into a 'Callable' will solve the question of easy use. With this, a no return 
expression can be as simple as:
   
   `testSubject.executeWithoutValue(() -> action.consumeValue("okay"));`



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to