You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2018/06/07 23:32:31 UTC
nifi git commit: NIFI-5279: Allow components up to 50 milliseconds to
complete validation before returning from update request
Repository: nifi
Updated Branches:
refs/heads/master 7b9d779a4 -> 729f8aa24
NIFI-5279: Allow components up to 50 milliseconds to complete validation before returning from update request
This closes #2770.
Signed-off-by: Andy LoPresto <al...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/729f8aa2
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/729f8aa2
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/729f8aa2
Branch: refs/heads/master
Commit: 729f8aa246767df4a2930771673ca2a7e18957bd
Parents: 7b9d779
Author: Mark Payne <ma...@hotmail.com>
Authored: Thu Jun 7 13:26:49 2018 -0400
Committer: Andy LoPresto <al...@apache.org>
Committed: Thu Jun 7 16:32:19 2018 -0700
----------------------------------------------------------------------
.../apache/nifi/web/StandardNiFiServiceFacade.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/729f8aa2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
index 5a01736..d00b73a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
@@ -303,6 +303,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
@@ -314,6 +315,7 @@ import java.util.stream.Stream;
*/
public class StandardNiFiServiceFacade implements NiFiServiceFacade {
private static final Logger logger = LoggerFactory.getLogger(StandardNiFiServiceFacade.class);
+ private static final int VALIDATION_WAIT_MILLIS = 50;
// nifi core components
private ControllerFacade controllerFacade;
@@ -660,7 +662,10 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
final RevisionUpdate<ProcessorDTO> snapshot = updateComponent(revision,
processorNode,
() -> processorDAO.updateProcessor(processorDTO),
- proc -> dtoFactory.createProcessorDto(proc));
+ proc -> {
+ awaitValidationCompletion(proc);
+ return dtoFactory.createProcessorDto(proc);
+ });
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processorNode);
final ProcessorStatusDTO status = dtoFactory.createProcessorStatusDto(controllerFacade.getProcessorStatus(processorNode.getIdentifier()));
@@ -669,6 +674,10 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
return entityFactory.createProcessorEntity(snapshot.getComponent(), dtoFactory.createRevisionDTO(snapshot.getLastModification()), permissions, status, bulletinEntities);
}
+ private void awaitValidationCompletion(final ComponentNode component) {
+ component.getValidationStatus(VALIDATION_WAIT_MILLIS, TimeUnit.MILLISECONDS);
+ }
+
@Override
public LabelEntity updateLabel(final Revision revision, final LabelDTO labelDTO) {
final Label labelNode = labelDAO.getLabel(labelDTO.getId());
@@ -2192,6 +2201,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
controllerService,
() -> controllerServiceDAO.updateControllerService(controllerServiceDTO),
cs -> {
+ awaitValidationCompletion(cs);
final ControllerServiceDTO dto = dtoFactory.createControllerServiceDto(cs);
final ControllerServiceReference ref = controllerService.getReferences();
final ControllerServiceReferencingComponentsEntity referencingComponentsEntity =
@@ -2582,7 +2592,10 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
final RevisionUpdate<ReportingTaskDTO> snapshot = updateComponent(revision,
reportingTask,
() -> reportingTaskDAO.updateReportingTask(reportingTaskDTO),
- rt -> dtoFactory.createReportingTaskDto(rt));
+ rt -> {
+ awaitValidationCompletion(rt);
+ return dtoFactory.createReportingTaskDto(rt);
+ });
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(reportingTask);
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(reportingTask.getIdentifier()));