while (port.isRunning()) { try { Thread.sleep(50L);
/** * Verified the specified remote port can be updated, if necessary. */ private void verifyUpdatePort(RemoteGroupPort port, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { // see if the remote process group can start/stop transmitting if (isNotNull(remoteProcessGroupPortDto.isTransmitting())) { if (!port.isRunning() && remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStart(); } else if (port.isRunning() && !remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStop(); } } // validate the proposed configuration final List<String> requestValidation = validateProposedRemoteProcessGroupPortConfiguration(port, remoteProcessGroupPortDto); // ensure there was no validation errors if (!requestValidation.isEmpty()) { throw new ValidationException(requestValidation); } // verify update when appropriate if (isAnyNotNull(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount(), remoteProcessGroupPortDto.getUseCompression(), remoteProcessGroupPortDto.getBatchSettings())) { port.verifyCanUpdate(); } }
/** * * @param port Port instance to be updated. * @param remoteProcessGroupPortDto DTO containing updated remote process group port settings. * @param remoteProcessGroup If remoteProcessGroupPortDto has updated isTransmitting input, * this method will start or stop the port in this remoteProcessGroup as necessary. */ private void updatePort(RemoteGroupPort port, RemoteProcessGroupPortDTO remoteProcessGroupPortDto, RemoteProcessGroup remoteProcessGroup) { if (isNotNull(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount())) { port.setMaxConcurrentTasks(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount()); } if (isNotNull(remoteProcessGroupPortDto.getUseCompression())) { port.setUseCompression(remoteProcessGroupPortDto.getUseCompression()); } final BatchSettingsDTO batchSettingsDTO = remoteProcessGroupPortDto.getBatchSettings(); if (isNotNull(batchSettingsDTO)) { port.setBatchCount(batchSettingsDTO.getCount()); port.setBatchSize(batchSettingsDTO.getSize()); port.setBatchDuration(batchSettingsDTO.getDuration()); } final Boolean isTransmitting = remoteProcessGroupPortDto.isTransmitting(); if (isNotNull(isTransmitting)) { // start or stop as necessary if (!port.isRunning() && isTransmitting) { remoteProcessGroup.startTransmitting(port); } else if (port.isRunning() && !isTransmitting) { remoteProcessGroup.stopTransmitting(port); } } }
public RemoteProcessGroupPortDTO createRemoteProcessGroupPortDto(final RemoteGroupPort port) { if (port == null) { return null; } final RemoteProcessGroupPortDTO dto = new RemoteProcessGroupPortDTO(); dto.setId(port.getIdentifier()); dto.setGroupId(port.getRemoteProcessGroup().getIdentifier()); dto.setTargetId(port.getTargetIdentifier()); dto.setName(port.getName()); dto.setComments(port.getComments()); dto.setTransmitting(port.isRunning()); dto.setTargetRunning(port.isTargetRunning()); dto.setConcurrentlySchedulableTaskCount(port.getMaxConcurrentTasks()); dto.setUseCompression(port.isUseCompression()); dto.setExists(port.getTargetExists()); dto.setVersionedComponentId(port.getVersionedComponentId().orElse(null)); final BatchSettingsDTO batchDTO = new BatchSettingsDTO(); batchDTO.setCount(port.getBatchCount()); batchDTO.setSize(port.getBatchSize()); batchDTO.setDuration(port.getBatchDuration()); dto.setBatchSettings(batchDTO); // determine if this port is currently connected to another component locally if (ConnectableType.REMOTE_OUTPUT_PORT.equals(port.getConnectableType())) { dto.setConnected(!port.getConnections().isEmpty()); } else { dto.setConnected(port.hasIncomingConnection()); } return dto; }
dto.setGroupId(remoteGroup.getIdentifier()); dto.setRunning(remoteGroupPort.isTargetRunning()); dto.setTransmitting(remoteGroupPort.isRunning()); dto.setExists(remoteGroupPort.getTargetExists()); if (isAuthorized) {