ferencerdei commented on code in PR #6733:
URL: https://github.com/apache/nifi/pull/6733#discussion_r1067823906
##########
c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/C2ClientService.java:
##########
@@ -59,11 +120,30 @@ private void processResponse(C2HeartbeatResponse response)
{
}
}
- private void handleRequestedOperations(List<C2Operation>
requestedOperations) {
- for (C2Operation requestedOperation : requestedOperations) {
- operationService.handleOperation(requestedOperation)
- .ifPresent(client::acknowledgeOperation);
+ private boolean requiresRestart(C2OperationHandler c2OperationHandler,
C2OperationAck c2OperationAck) {
+ return c2OperationHandler.requiresRestart() &&
isOperationFullyApplied(c2OperationAck);
+ }
+
+ private boolean isOperationFullyApplied(C2OperationAck c2OperationAck) {
+ return Optional.ofNullable(c2OperationAck)
+ .map(C2OperationAck::getOperationState)
+ .map(C2OperationState::getState)
+ .filter(FULLY_APPLIED::equals)
+ .isPresent();
+ }
+
+ private boolean initiateRestart(LinkedList<C2Operation>
lRequestedOperations, C2Operation requestedOperation) {
+ try {
+ disableHeartbeat();
+ requestedOperationDAO.save(new OperationQueue(requestedOperation,
lRequestedOperations));
Review Comment:
sure, I missed this one
--
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]